zoukankan      html  css  js  c++  java
  • 将unicode下的wstring转化成ansi下的string

    //将unicode下的wstring转化成ansi下的string
    inline std::string UnicodeToASCII(LPCTSTR lpszText)
    {
        int length=_tcslen(lpszText);

        TCHAR* pWideCharStr=new TCHAR[length+1];
        char* data=new char[2*length+2];

        _tcscpy(pWideCharStr, lpszText);

        WideCharToMultiByte(CP_ACP, 0, pWideCharStr, -1, data, 2*length + 2, NULL, NULL);

        std::string strText = data;

        delete []data;
        delete []pWideCharStr;

        return strText;
    }

  • 相关阅读:
    svn上传文件钩子
    linux服务器版svn安装
    csp-s模拟55
    csp-s模拟54
    csp-s模拟53
    csp-s模拟52
    csp-s模拟51
    csp-s模拟50
    csp-s模拟49
    csp-s模拟48
  • 原文地址:https://www.cnblogs.com/mazhenyu/p/1981580.html
Copyright © 2011-2022 走看看