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