Read a resource file txt in android

Read a resource file txt in android
0.0 0


i’m using cocos2d-x 1.0.1-r12
i have a file aaa.txt, that contains some strings, in resource folder
i’d like to read it.
tried many times with:

    textFileName = cocos2d::CCFileUtils::fullPathFromRelativePath(textFileName.c_str());
    FILE *fp = fopen(textFileName.c_str(), "r");
    if(fp==NULL) CCLog("nooooooooooooo");
    else CCLog("siiiiiiiiiii");

unsigned char *p=CCFileUtils::getFileData(textFileName,"r",pSize);
seem not exists

how can i read that file?

std::string fullPath = CCFileUtils::fullPathFromRelativePath(YOUR_FILENAME);
unsigned char* mFileData = NULL;
unsigned long bufferSize = 0;
mFileData = CCFileUtils::getFileData(fullPath.c_str(), "r", &bufferSize); 


thanks works great


The new version is simply:

auto contents = FileUtils::getInstance()->getStringFromFile("file_under_resources_folder");