in trying to read a file that i put in resource folder
FILE *fp = fopen("dictionary.txt", "r");
char buf[50] = {0};
fgets(buf, 50, fp);
fclose(fp);
CCLabelTTF* pLabel = CCLabelTTF::labelWithString(buf, "Arial", 24);
this works fine in windows but crashes in android,
std::string textFileName = "dictionary.txt";
textFileName = cocos2d::CCFileUtils::fullPathFromRelativePath(textFileName.c_str());
cocos2d::CCFileData data(textFileName.c_str(), "r");
unsigned long nSize = data.getSize();
unsigned char* pBuffer = data.getBuffer();
works but i need to read the file line by line.
i tested cocos2d::CCFileUtils::fullPathFromRelativePath and it gives “dictionary.txt” while in android so i think the path is ok.