首页 > 代码库 > cocos2d-x3.0 用CCDictionary写文件
cocos2d-x3.0 用CCDictionary写文件
bool CDownLoad_LocalData::WriteToConfigFile( DownLoadLocalData* downdata ){
CCDictionary* pDict = CCDictionary::create();unsigned int lessonid = downdata->lession_id;
char s_lessonid[10];
sprintf(s_lessonid,"%d",lessonid);
CCString* pValue1 = CCString::create(s_lessonid);
CCString* pValue2 = CCString::create(downdata->fileLocal_path);
CCString* pValue3 = CCString::create(downdata->downUrl);
pDict->setObject(pValue1, "lessonid");
pDict->setObject(pValue2, "fileLocal_path");
pDict->setObject(pValue3, "downUrl");
m_total_dict->setObject(pDict,pValue1->getCString());
if(m_total_dict->writeToFile(m_fileapth.c_str()))//m_fileapth为写文件的路径
CCLog("Write to file success!");
return true;
}
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。