My App would download a file which the first 12 byte data was encrypted,so I have to read this file from Document and decrypt the first 12 byte data.
My first try was to read the whole file and decrypt it then write to file again. but if the file is too large , this will cost a lot of memory.
So ,Is there anyway to let me read the first 12 byte data and replace it?
This is a std way of doing in any language.
Read a file in chunk Replace in Buffer write in Temporary file delete the original file and rename temporary file as original file.
As far as objective C concerned i found a useful link
http://www.techotopia.com/index.php/Working_with_Files_in_Objective-C
goto this topic "Writing Data to a File"