CString yourString = . . .;
CStringA ansiString(yourString);
此时 ansiString可以作为const char*型调用
CString str;
const char* cstr = (LPCTSTR)str;
CString str;
const TCHAR* cstr = (LPCTSTR)str;
//将LPCTSTR转换成const char*型。因为在宽字符系统里 LPCTSTR = const TCHAR* char *pTempPath;
LPCTSTR lpszPathName;
int lenPath = WideCharToMultiByte(CP_OEMCP,NULL,lpszPathName,-1,NULL,0,NULL,FALSE); //需要的字符长度
pTempPath = new char[lenPath];
WideCharToMultiByte (CP_OEMCP,NULL,lpszPathName,-1,pTempPath,lenPath,NULL,FALSE); //转化字符