json \u unicode字符串转化 c++

时间:2022-01-29 06:33:59
CString GetUStr(const string & str)
{
std::string showname = str;//\u6211\u7231\u5317\u4eac\u5929\u5b89\u95e8
int len=strlen(showname.c_str())+;
char outch[MAX_PATH];
WCHAR * wChar=new WCHAR[len];
wmemset(wChar,,len);
MultiByteToWideChar(CP_UTF8, , showname.c_str(), len, wChar, len);
CString strRet = wChar;//转化结果 我爱北京*
delete [] wChar;
return strRet;
}