、
使用_tcscpy_s:
CString theString( "This is a test" );
sizeOfString = (theString.GetLength + 1);
LPTSTR lpsz = TCHAR[ sizeOfString ];
_tcscpy_s(lpsz, sizeOfString, theString);
最后再转换下lpsz为const型
LPTSTR在UNICODE环境下编译是whca_t类型
2、
CString str = _T("Hello World!");
char szStr[256] = {0};
wcstombs(szStr, str, str.GetLength);
const char * p = szStr;
最新评论