最简单的CString 和 string 互转

string----->CString:
string strMembers;
CString strName = (WCHAR*)(CA2W(strMembers.c_str(),CP_UTF8));

CString---->string:
CString strInfo;
std::string strParam = ((CStringA)CW2A(strInfo)).GetBuffer();

 

CString ---->  const char*:   const char* = CW2A(CString.GetBuffer(0), CP_UTF8).m_psz
BYTE* ---->  std::string:   std::string = std::string((char*)BYTE*, ulOutputLen);

CStringA strUrlListValueA;
CString strUrlListValue;
strUrlListValue = CA2W(strUrlListValueA, CP_UTF8);    //解决中文乱码    

你可能感兴趣的:(c++)