1、多字符集下转换
CString cstr;
char *p =(LPSTR)(LPCTSTR)cstr;
注意:次方法只能转换成char*不能转换成char[]数组
2、宽字符集下转换
int len =WideCharToMultiByte(CP_ACP,0,m_WriteFilePath,-1,NULL,0,NULL,NULL);
char *ptxtTemp =new char[len +1];
// 0 要转换的CString型变量 转换结果
WideCharToMultiByte(CP_ACP,0,m_WriteFilePath,-1,ptxtTemp,len,NULL,NULL );
delete []ptxtTemp;