方法1:
路径字符串。
CString strPathName == L“1q221“;
char szPathName[MAX_PATH]="";
int len = WideCharToMultiByte(CP_ACP,0,strPathName,strPathName.GetLength(),NULL,0,NULL,NULL);
WideCharToMultiByte(CP_ACP,0,strPathName,strPathName.GetLength() + 1 ,szPathName,len + 1 ,NULL,NULL);
szPathName[len] = '\0'; //多字节字符以'\0'结束
方法2:
#include"atlconv.h"
USES_CONVERSION;
const char*s = W2A(pathName.GetBuffer());