C++ 窄字符转换为宽字符

wstring A2W(const string &s)
{
    const char * szSource = s.c_str();
    size_t _Dsize = MultiByteToWideChar(CP_ACP,0,szSource,-1,NULL,0);
    wchar_t * wszDest = new wchar_t[_Dsize];
    MultiByteToWideChar(CP_ACP,0,szSource,-1,wszDest,_Dsize);
    wstring result = wszDest;
    delete []wszDest;
    return result;
}
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭