说明:我的CString内部封装的是wchar_t(宽字符)
方法1:使用WideCharToMultiByte
int length = ShowInfo.GetLength();
char *pinfo = new char[length * 2];
WideCharToMultiByte(CP_ACP, 0, m_ShowInfo, length, pinfo, length * 2, NULL, NULL);
//处理。。。
delete pinfo;
方法2:使用W2A或T2A
USES_CONVERSION;//声明宏
char *pinfo = W2A(ShowInfo);//内容过大时会导致栈溢出,目前测试数据量长度为40万没有问题,52万时提示栈溢出
//处理。。。
其中ShowInfo是CString类型。