Unicode and ANSI string conversion methods in Windows Mobile and Windows

Source: Internet
Author: User

In Windows Mobile and Windows, the string is Unicode. Therefore, when developing native code, pay special attention to String Conversion. Below is a simple String Conversion method. Record it for search.

Char Sza [ 100 ]; // ANSI
Wchar SZW [ 200 ]; // Unicode

// regular call of sprintf: all strings are in ANSI
sprintf (sza, " % S " , " ansi str " );

// convert string from Unicode into ANSI
sprintf (sza, " % S " , " Unicode STR " );

// regular call swprintf. all string are in Unicode
swprintf (SZW, L " % S " , L " Unicode STR " );

//Convert string from ANSI into Unicode
Swprintf (SZW, l"% S","ANSI Str");

 

code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/

--> // convert cstring (UNICODE) to STD :: string
cstring STR = " Mel " ;
STD: string city = ct2ca (STR);

//Convert STD: string to cstring (UNICODE)
STD ::StringStr= "AA";
Cstring CSTR=Ccombstr (STR );

 

For more information, see

This article clarifies the character sets of Windows Mobile and Windows WinCE (Windows Embedded CE ).

 

Related Article

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.