Tinyxml2 parsing xml error, PC running normal, Android crash, tinyxml2android

Source: Internet
Author: User

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 ();





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.