Tinyxml2 parsing xml error, PC running normal, Android crash, tinyxml2android
Just now, my friend asked me to help you see why his game was decommissioned after Android was packaged. It was normal on the PC. After a while, I found that the problem lies in tinyxml2. He wrote it like this.
Tinyxml2: XMLDocument * doc = new tinyxml2: XMLDocument (); XMLError errorID = doc-> LoadFile ("config. xml "); XMLElement * root = doc-> RootElement ();
In PC LoadFile, XML parsing can be found normally, but this XML cannot be found on Android. Just load it like this.
Tinyxml2: XMLDocument * doc = new tinyxml2: XMLDocument (); ssize_t bufferSize; auto pBuffer = CCFileUtils: sharedFileUtils ()-> getFileData ("config. xml "," rb ", & bufferSize); int error = doc-> Parse (const char *) pBuffer); pBuffer [(int) bufferSize-1] = '\ 0'; XMLElement * root = doc-> RootElement ();