开发者

Create, save, and read text file

I want to open one blank new text file on a button event, 开发者_如何转开发edit the text, and save it in a directory, and also read that file at any time.


You can read a text file into a string with this method on NSString:

+ (id)stringWithContentsOfFile:(NSString *)path
                  usedEncoding:(NSStringEncoding *)enc
                         error:(NSError **)error

You can write it again with:

 - (BOOL)writeToFile:(NSString *)path 
          atomically:(BOOL)useAuxiliaryFile 
            encoding:(NSStringEncoding)enc 
               error:(NSError **)error
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜