(1)CString转换为string
- CString cs(_T("cs"));
- string s;
- s = (LPCSTR)(CStringA)(cs);
(2)string转换为CString
- string s ="Hello World!中国";
- CString cs(s.c_str());
(3)string转换为LPWSTR
- ///string ---to-----LPWSTR
- wstring widstr;
- std:string s("DanTeng");
- widstr = std::wstring(s.begin(), s.end());
- lvItem.pszText=(LPWSTR)widstr.c_str();