读写默认配置文件:
UserDefault::getInstance()->setStringForKey("data","Hello lidaha!");
CCLOG("%s",UserDefault::getInstance()->getStringForKey("data.ini","Hello World"));
读写文件:
auto fu = FileUtils::getInstance();
CCLOG("%s",fu->getWritablePath()); //获取允许操作的目录
//打开文件
FILE *fp = fopen(fu->fullPathFromRelativeFile("data.txt",fu->getWritablePath()).c_str(),"w");
fprintf(fp,"Hello Lidaha!\n");
fclose(fp);
//读取文件数据
auto dt = fu->getDataFromFile(fu->fullPathFromRelativeFile("data.txt",fu->getWritablePath()));
CCLOG("%s",dt.getBytes());