Cocos2d: CCFileUtils: sharedFileUtils ()-) getFileData (szFile, & quot; r & quot;, & amp; bufferSize) different platform return values are different
String pathKey = CCFileUtils: sharedFileUtils ()-> fullPathForFilename (fileName); unsigned char * pBuffer = NULL; unsigned long bufferSize = 0; pBuffer = CCFileUtils: sharedFileUtils () -> getFileData (pathKey. c_str (), "rb", & bufferSize );
When I read a csv file using CCFileUtils: sharedFileUtils ()-> getFileData (szFile, "r", & bufferSize, it is found that the value of win32 platform is sometimes smaller than that of other platforms.
The reason is: CCFileUtils: getFileData (szFile, "r", & bufferSize) for a text file (wrap with \ r \ n)
The file size obtained by running in win32 is smaller. It seems that \ r has been deleted, but the complete size is obtained in OS.
Currently, you can only read text files in binary mode to ensure that the execution results on different platforms are identical.
Cocos2d: CCFileUtils: getFileData (szFile, "rb", & bufferSize );