CString -> int / string -> int
// 根据环境自适应转换
CString s = _T("123");
int n = _tstoi(s);
// UNICODE 环境下,相当于..
CString s = TEXT("123");
int n = _wtoi(s);
// ANSI 环境下, 相当于..
string s = "123";
int n = atoi(s);
CString -> TCHAR[] / string -> char[] / CString -> WCHAR[]
//自适应环境
// ANSI
string s = "abc123"
char c[10];
strcpy(c, s);
// or
char* pc = s;
// UNICODE
CString s = _T("abc123")
WCHAR wc[10];
wcscpy_s(wc, s);
_tcscpy
_tcscpy是一个拷贝字符串,源字符串指针是strSource,有strcpy、wcscpy、_mbscpy三种类型,这三种形式都返回目标字符串
相关函数在msdn上的解释: https://msdn.microsoft.com/zh-cn/library/td1esda9.aspx
[cpp] view plain copy
char *strcpy( char *strDestination, const char *strSource );
wchar_t *wcscpy( wchar_t *strDestination, const wchar_t *strSource );
unsigned char *_mbscpy( unsigned char *strDestination, const unsigned char *strSource );
未完待续...