Convert CString to std::wstring
问题 How can I convert from CString to std::wstring ? 回答1: To convert CString to std::wstring : CString hi("Hi"); std::wstring hi2(hi); And to go the other way, use c_str() : std::wstring hi(L"Hi"); CString hi2(hi.c_str()); 回答2: Try this: std::wstring strString((LPCTSTR)strCString); 回答3: This should work as CString has operator LPCTSTR() defined: CString s; std::wstring s1 = s; 回答4: CString s = _T("Привет"); USES_CONVERSION; std::wstring ws(A2W((LPCTSTR)s)); 来源: https://stackoverflow.com/questions