我从Windows的(PROCESSENTRY32)pe32.szExeFile获取了一个WCHAR[MAX_PATH]。以下方法均不起作用:
std::string s;
s = pe32.szExeFile; // compile error. cast (const char*) doesnt work either
并且
std::string s;
char DefChar = ' ';
WideCharToMultiByte(CP_ACP,0,pe32.szExeFile,-1, ch,260,&DefChar, NULL);
s = pe32.szExeFile;
std::string
吗?它应该可以直接转换为std::wstring
,就像这样:std::wstring s(pe32.szExeFile);
- Jerry Coffin