Hello,
I am building a game in cocos2dx and I am saving game data in CCUserDefault. Now I have decided to save this data on any server.
What I do is accessing XML file of CCUserDefault and convert it into JSON.
My app crashes doing so and the reason is some garbage values at the end of XML file as shown in the image. App works fine whenever garbage values doesn’t appear.
:;qst
here is my code
xmlData = CCFileUtils::sharedFileUtils()->getFileData(CCUserDefault::sharedUserDefault()->getXMLFilePath().c_str(), "r", &tmpSize);
CCLOG("%s",xmlData); // This prints the XML values
jsonString = xml2json(CCString::createWithFormat("%s",xmlData)->getCString());
xmlissue.png (23.9 KB)
xmlissue.png (23.9 KB)