CString与LPCWSTR的转化
CString cstr;
LPCWSTR lstr = (LPCWSTR)(LPCSTR)cstr
LPCWSTR pcwStr
=
L
"
TestpwcStr
"
;
CString str(pcwStr);
CString str(pcwStr);
C++实现CString和string的互相转换
CString->std::string 例子:
CString strMfc=“test“;
std::string strStl;
strStl=strMfc.GetBuffer(0);
unicode情形下:
CStringW strw = _T("test");
CStringA stra(strw.GetBuffer(0));
strw.ReleaseBuffer();
std::string imgpath=stra.GetBuffer(0);
stra.ReleaseBuffer();
std::string->CString 例子:
CString strMfc;
std::string strStl=“test“;
strMfc=strStl.c_str();