06 - writeToFile写入不成功/无法写入的原因

error: writeToFile写入不成功/无法写入的原因

[cacheDic writeToFile:cacheURL atomically:YES];

后却返回no,查阅手册发现:

If an array or dictionary contains objects that are not property-list objects, then you cannot save and restore the hierarchy of data using the various property-list methods and functions.

分析:

  1. 也就说要存的不能为你自定义的对象,也不能是null
  2. 服务器返回数据中含有数个null

fix - BUG: OC暂时无法解决,在线解析数据

简书地址:http://www.jianshu.com/users/227bbeb09f91/latest_articles
从键盘输入一个长度不超过100个字符的字符串,然后做如下操作: (1)将字串中的小写字母转为大写,大写字母转为小写,而其它字符不作处理。 (2)将字串输出保存到一个名为“ex801.txt”的文本文件中。注:文本文件ex801.txt应与源码文件ex801.c保存在同一个文件夹中。 目前,已编写完成main函数,请编程实现writeToFile函数,具体功能和要求如下所示。 /* @Filename: ex801.c @Author: Ju Chengdong @Version: 1.0 @Date: 2021-03-18 @Description: File Character Reading and Writing */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc,char *argv[]){ /*(1)声明函数及变量*/ int writeToFile(char *str, char *fileName, char *mode); char str[100]; char fileName[] = "ex801.txt"; /*(2)获取键盘输入字串*/ fgets(str, 100, stdin); //gets(str); //将回车看作字串输入结束标志,字串中可以有空格 //scanf("%s", str); //将空格看作字串输入结束标志,字串中不能有空格 /*(3)将字串写入文件*/ int charNum = writeToFile(str, fileName, "w"); if(charNum < 0){ //printf("write error");//用于调试 return -1; } return 0; } /* * 函数名称:writeToFile * 函数功能:将字串写入文件 * 形式参数:char *str,一维字符数组(字符串)首地址 * 形式参数:char *fileName,待写入的文件路径及名称 * 形式参数:char *mode,文件使用方式 * 返 回 值:int型,若文件打开异常,返回 -1;否则返回写入到文件的字符数 */ int writeToFile(char *str, char *fileName, char *mode){ // 请编程实现本函数 } 其他说明:无 【源文件名】ex801.c 【输入形式】标准输入:从键盘任意输入不超过100个字符的字串 【输出形式】文件输出:将字串转换后输出到文件
05-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值