//在ios里能读到 android就读不到 解决方法
CCFileUtils* gameFile = CCFileUtils::sharedFileUtils();
std::string strFileFullPath = gameFile->getWritablePath();
char *file_In = NULL;
if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
{
file_In = (char*)(gameFile->fullPathForFilename(CCString::createWithFormat("%suserdata.xml",strFileFullPath.c_str())->getCString()).c_str());
}
else
{
file_In =(char*)(CCString::createWithFormat("%suserdata.xml",strFileFullPath.c_str())->getCString());
}
FILE *file = fopen(file_In,"rt");
//本人从CCFIleUtils 类里面 弄出来的 嘿嘿 ~
cocos2dx ios android 读取资源问题
最新推荐文章于 2022-05-09 15:21:19 发布