Unicode类型的CString转化为char*

 CString strPath = L"adfafs主声音文件fsfsa";
 int nLength = strPath.GetLength();
 int nBytes = WideCharToMultiByte(CP_ACP,0,strPath,nLength,NULL,0,NULL,NULL);
 char* VoicePath = new char[ nBytes + 1];
 memset(VoicePath,0,nLength + 1);
 WideCharToMultiByte(CP_OEMCP, 0, strPath, nLength, VoicePath, nBytes, NULL, NULL);
 VoicePath[nBytes] = 0; 

你可能感兴趣的:(Unicode类型的CString转化为char*)