开发者

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.

开发者_如何学JAVA

Thanks 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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜