代码均来自网络
CString 转换成string
unicode:
CString sz1 = L"abc";
std::string sz2 = CT2A(sz1.GetBuffer()); //转化为非unicode.
非unicode:
CString sz1 = "abc";
std::string sz2 = sz1.GetBuffer();
CString 转换成int
CString cs1;
int a = _ttoi(cs1);
string 转换成Cstring
CString cs1;
string s1;
cs1.Format(_T("%s"),s1);
int 转换成CString
CString cs1;
int i;
cs1.Format(_T("%d"),i);