zoukankan      html  css  js  c++  java
  • c++ Ansi和Unicode相互转换

    int Ansi_To_Unicode(string strSrc, wstring& strRet)
    {
      wchar_t wBuff[102400] = { 0 };
      CHAR sBuff[102400] = { 0 };
      int iRet = MultiByteToWideChar(CP_ACP, 0, strSrc.c_str(), -1, wBuff, 102400);
      if (iRet > 0) {
        strRet = wBuff;
        return TRUE;
      }
      return FALSE;
    }

    int Unicode_To_Ansi(wstring strValue, string& strRet)
    {
      CHAR sBuff[102400] = { 0 };
      int iRet = WideCharToMultiByte(CP_ACP, 0, strValue.c_str(), -1, sBuff, 102400, NULL, NULL);
      if (iRet > 0) {
        strRet = sBuff;
        return TRUE;
      }
      return FALSE;
    }

  • 相关阅读:
    代码4
    readline,readlines,read函数
    代码3
    find函数
    字典的循环和if语句
    代码2
    代码1
    python除法
    字符串
    print函数
  • 原文地址:https://www.cnblogs.com/longma8586/p/13929166.html
Copyright © 2011-2022 走看看