ios开发中,读写文件
2016-08-15 本文已影响81人
多啦A梦的百宝袋
NSString *file = @"/Users/onlyou1991/Desktop/11.txt”;
//读取文件成字符串
NSString *dataStr = [[NSString alloc]initWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil];
//以回车换行分割字符串
NSArray *aryStr = [dataStr componentsSeparatedByString:@"\r\n”];
//将字符串str写入到文件中
[str writeToFile:file2 atomically:YES];