OC中读写文件到本地
来源:互联网 发布:神盾网络验证山寨 编辑:程序博客网 时间:2024/06/11 03:05
//写文件
// return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
NSMutableString *mystring = [[NSMutableStringalloc] init];
NSError *err;
for(int i =0; i < 10; i++){
[mystring appendString:@"This is for reading file .\n"];
[mystring writeToFile:@"/tmpa/myfile2.txt"
atomically:YES
encoding:NSUTF8StringEncoding
error:&err];
}
NSLog(@"Yes, the file is writen done with %@", [errlocalizedDescription]);
//读文件
NSError *readerr;
NSString *str = [[NSStringalloc] initWithContentsOfFile:@"/tmp/myfile2.txt"
encoding:NSUTF8StringEncoding
error:&readerr];
if(!str){
NSLog(@"Read file with Error:%@", [readerrlocalizedDescription]);
}else{
NSLog(@"The file has the contents as below: %@", str);
}
- OC中读写文件到本地
- JS 读写文件到本地
- OC中读写文件 (本地文件/网络文件)
- OC学习:文件读写
- OC-文件读写
- OC字符串写入到.txt文件中
- 07-OC中通过NSString读写文件(File/NSURL)
- 09-OC中NSArray的文件读写(File/NSURL)
- 14-OC中NSDictionary常用方法,遍历,读写文件
- 将字符串读写到文件中
- freemarker将文件读写到HTML中
- OC-文件的读写操作
- 网络文件下载到本地项目中
- windos本地传送文件到winsever中
- Unity中写文件到本地
- js读写本地xml文件
- oc 字符串 数组 字典 存到文件中
- C#中从服务器中下载execl文件到本地
- 第三周3
- 轻松改善网站安全的方法
- Mysql函数 例题 stage1-8
- Delphi字符串 消息机制实现消息传递字符串
- 卷积神经网络之 fine-tuning
- OC中读写文件到本地
- win10 CPU only安装caffe 解决 无法打开包括文件: “caffe/include_symbols.hpp”
- TCP协议中的三次握手和四次挥手(图解)
- WebAPI返回一个List
- Linux查找包含某关键词的所有文件
- android shape详解
- Merge Two BinaTree
- 每天一个linux命令(2):cd命令
- 跑外业的也能协同干活儿了:矢量云端分享