How to Write File(*.txt) Use CCFileUtils...

when i use fopen and fwrite function, not play eclipse android simulator…

How to Write File Use CCFileUtils…

Please refer to the source code of CCUserDefault.

std::string filePath = CCFileUtils::getWriteablePath() + "myfile.txt";
FILE *fp = fopen(filePath.c_str(), "r");
fwrite(...);
...
fclose(fp);

thank you Walzer Wang~

I resolve on account of your answer…^^
:slight_smile:

The code is now:

CCFileUtils::sharedFileUtils()->getWritablePath()

if you get here via Google.

These documents are useful as well:

http://www.cocos2d-x.org/wiki/How_to_read_and_write_file_on_different_platforms