首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

cocos2d-x 读取沙盒资料的方法

2012-11-11 
cocos2d-x 读取沙盒文件的方法std::string fullPath CCFileUtils::fullPathFromRelativePath(find.txt

cocos2d-x 读取沙盒文件的方法

    std::string fullPath = CCFileUtils::fullPathFromRelativePath("find.txt");

    unsigned char* pBuffer = NULL;

    unsigned long bufferSize = 0;

    pBuffer = CCFileUtils::getFileData(fullPath.c_str(), "r", &bufferSize);

    

    CCLog("%ld",bufferSize); 

    for (int i = 0; i < bufferSize; ++i) 

    {

        CCLog("%c",pBuffer[i]);

    }

    

    if (pBuffer)

    {

        delete [] pBuffer;

        pBuffer = NULL;

    }

热点排行