当前位置:编程学习 > wap >>

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;

补充:移动开发 , 其他 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,