//方法一:
CString filePath="xxxxxx";
int len = WideCharToMultiByte(CP_ACP, 0, filePath, -1, NULL, 0, NULL, NULL);
char *buf = new char[len + 1];
WideCharToMultiByte(CP_ACP, 0, filePath, -1, buf, len, NULL, NULL);
delete[] buf;
//方法二:
CString str="xxxxxx";
char* mychar=(char*)str.GetBuffer();
CString转char*
于 2023-09-05 10:44:10 首次发布