Using tinyxml in MFC

Source: Internet
Author: User

Download the new version from the http://sourceforge.net/projects/tinyxml/ and copy the six files to the project tinystr. h tinyxml. h tinystr. cpp tinyxml. cpp tinyxmlerror. cpp tinyxmlparser. cpp

Add # include "stdafx. H" to the header of the CPP file, where you want to use # include "tinyxml. H"

 

Wchar_t * commtools: u8tounicode (const char * szu8) {int wcslen =: multibytetowidechar (cp_utf8, null, szu8, strlen (szu8), null, 0 ); wchar_t * wszstring = new wchar_t [wcslen + 1];: multibytetowidechar (cp_utf8, null, szu8, strlen (szu8), wszstring, wcslen ); wszstring [wcslen] = '\ 0'; return wszstring;

}

 

Cstringa commtools: cstringtocstringa (cstring Str)

{// Convert a tchar string to a lpcstr ct2ca pszconvertedansistring (STR); // construct a STD: string using the lpcstr input cstringa result (pszconvertedansistring); return result ;}

 

If the value of the gettext node is null, null is returned. You can determine the value before gettext.

If (cityidele-> gettext ()! = NULL) wcscpy_s (cityinfolist [itmpc]. CID, commtools. u8tounicode (cityidele-> gettext (); else

Wcscpy_s (cityinfolist [itmpc]. CID, l "");

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.