【MFC】将CString类型的十六进制数字,转换成整形(在使用Unicode字符集的情况)

//将字符串类型的十六进制字符   转换成   unsigned int 类型的数字

CString tmp(_T("234DF"));

int nLength = tmp.GetLength();
int nBytes = WideCharToMultiByte(CP_ACP,0,tmp,nLength,NULL,0,NULL,NULL);
char* VoicePath = new char[ nBytes + 1];
memset(VoicePath,0,nLength + 1);
WideCharToMultiByte(CP_OEMCP, 0, tmp, nLength, VoicePath, nBytes, NULL, NULL); 
VoicePath[nBytes] = 0;
sscanf(VoicePath,"%x",&TempDataFrame);
delete [] VoicePath;

你可能感兴趣的:(【MFC】将CString类型的十六进制数字,转换成整形(在使用Unicode字符集的情况))