Compared with C ++, the type of the MFC package is quite uncomfortable, and sometimes it is difficult to change the type. Especially when it is related to encoding, it is particularly depressing and may not be familiar with MFC yet.
Sometimes it is naive to think about why there is no type conversion method under the type of MFC. If this is the case, it would be nice to use one method, so there would be no need for Baidu Google to do so much.
1. Convert CString to int
[Cpp]
CString k;
Int I = _ ttoi (k );
CString k;
Int I = _ ttoi (k );
2. Convert int, char, string to CString
[Cpp]
CString ss;
Int I;
String str;
Char * ch;
Ss. Format ("% d, % s, % s", I, str. c_str (), ch );
CString ss;
Int I;
String str;
Char * ch;
Ss. Format ("% d, % s, % s", I, str. c_str (), ch );
3. Convert CString to string
[Cpp] www.2cto.com
CString ss;
String strNowGroupInfo = CStringA (ss );
CString ss;
String strNowGroupInfo = CStringA (ss );
Author: wyz365889