Write to file with some problem


#1

I write down the problem in evernote.
Cocos2d-x文件写入遇到问题


#2

Try:

FILE * fp = fopen( m_filePath.c_str(), "w+" );
if ( fp ) {
    fputs( m_dataToSave.c_str(), fp );
    int r = ferror( fp );
    fclose( fp );
    if ( r == 0 ) {
            CCLOG( "Save success." );
    } else {
            CCLOG( "Save failed. Error code %d", r );
    }
} else {
    CCLOG( "Save failed. Can't create file." );
}