您的位置:首页 > 电脑网络 > 电脑配件 > CHAR * wchar_t WCHAr CString 之间的转换

CHAR * wchar_t WCHAr CString 之间的转换

luyued 发布于 2011-04-19 03:32   浏览 N 次  

view plaincopy to clipboardprint?
  1. inline wchar_t* Utf8ToUnicode( const char* szStr )
  2. {
  3. int nLen = strlen(szStr) + 1;
  4. int nwLen = MultiByteToWideChar(CP_ACP, 0, szStr, nLen, NULL, 0);
  5. wchar_t* lpsz = new wchar_t[nLen + 1];
  6. MultiByteToWideChar(/*CP_ACP*/CP_UTF8, 0, szStr, nLen, lpsz, nwLen);
图文资讯
广告赞助商