Convert ANSI to Unicode to ANSI

Source: Internet
Author: User

Convert ANSI to Unicode
(1) Use the macro L, for example, clsidfromprogid (L "mapi. folder", & CLSID );
(2) Implement conversion through the multibytetowidechar function, for example:
Char * szprogid = "mapi. folder ";
Wchar szwideprogid [128];
CLSID;
Long llen = multibytetowidechar (cp_acp, 0, szprogid, strlen (szprogid), szwideprogid, sizeof (szwideprogid ));
Szwideprogid [llen] = '/0 ';
(3) using the a2w macro, for example:
Uses_conversion;
Clsidfromprogid (a2w (szprogid), & CLSID );

Convert Unicode to ANSI
(1) Use widechartomultibyte, for example:
// Assume that you already have a unicode string wszsomestring...
Char szansistring [max_path];
Widechartomultibyte (cp_acp, wc_compositecheck, wszsomestring,-1, szansistring, sizeof (szansistring), null, null );
(2) Use the w2a macro, for example:
Uses_conversion;
Ptemp = w2a (wszsomestring );

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.