When you are developing MFC project in most cases it becomes necessary to convert between 'CString' and 'std::string' .
SOLUTION:
'CString' to 'std::string':
CString sTest ("Matrix"); // Convert a TCHAR string to a LPCSTR CT2CA CStringToAscii(sTest); // construct a std::string using the LPCSTR input std::string sResultedString (CStringToAscii);
'std::string' to 'CString':
std::string sTest("Matrix"); CString ResultedCString(sTest.c_str());
No comments:
Post a Comment