zoukankan      html  css  js  c++  java
  • Unicode和多字节的相互转换

    多字节转Unicode

    四步:

    Step1  

    #include <iostream>
    #include "windows.h"
    using namespace std;
    
    void ANSIToUnicode(const char str[])
    {
        //获取持转换的字符个数
        int unicodeLen = MultiByteToWideChar( 
            CP_ACP,
            0,
            str,
            -1,
            NULL,
         0 );
    //分配宽字符内存 wchar_t * pUnicode = new wchar_t[unicodeLen]; //多字节->宽字符 MultiByteToWideChar( CP_ACP, 0, str, -1, pUnicode, unicodeLen ); /* ...对生成结果进行处理 ...*/ delete []pUnicode; } int main() { char msg[]="M11中文网"; ANSIToUnicode(msg); return 0; }
  • 相关阅读:
    JZOJ.2117. 【2016-12-30普及组模拟】台风
    团队合作
    长沙游记
    统计
    html....
    OI之路
    三鑫普及组模拟赛
    牛顿迭代法
    台风
    gcd
  • 原文地址:https://www.cnblogs.com/tinaluo/p/8118430.html
Copyright © 2011-2022 走看看