updatefile in application folder
NSString *conent = @"One\nnghTwo\nThree\nFour\nFive";
//save content to the documents directory
[conent writeToFile:fileName
atomically:NO
encoding:NSStringEncodingConversionAllowLossy
error:nil];
here is the code to write data in to file
i want to update that file i have 2000 lines to write as application is used.
开发者_如何学JAVAThanks for help.
You need to use the NSFileHandle class then writeData, the writing takes place at the file pointer’s current position so use seekToEndOfFile to move the pointer first.
NSFileHandle *fh = [NSFileHandle fileHandleForWritingAtPath:@"One\nnghTwo\nThree\nFour\nFive"]
[fh seekToEndOfFile];
[fh writeData:data];
精彩评论