Seektoendoffile
Attaches the content of a file to another file. Open another file for writing, locate the end of the file, and write the content of the first file to the second file.
CodeAs follows:
# import
int main (INT argc, const char * argv []) {@ autoreleasepool {nsfilehandle * infile, * OUTFILE; nsdata * buffer; // open filea to read the infile = [nsfilehandle filehandleforreadingatpath: @ "filea.txt"]; If (infile = nil) {nslog (@ "open of filea.txt reading failed "); return 1;} // open fileb to update the operation OUTFILE = [nsfilehandle filehandleforwritingatpath: @ "fileb.txt"]; If (OUTFILE = nil) {nslog (@ "open of fileb for writing failed"); return 2;} // locate and locate the end of OUTFILE (append the file here) [OUTFILE seektoendoffile]; // read the infile and write its content to the OUTFILE buffer = [infile readdatatoendoffile]; [OUTFILE writedata: Buffer]; // close the read/write file [infile closefile]; [OUTFILE closefile];} return 0 ;}
After the search operation is completed, seektoendoffile returns the offset of the current file. Ignore this value. You can use this information to obtainProgramFile Size in
Address: http://blog.csdn.net/enuola/article/details/7797353