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

来源:互联网 发布:51单片机蜂鸣器电路图 编辑:程序博客网 时间:2024/06/05 04:24

//将字符串类型的十六进制字符   转换成   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;
0 0
原创粉丝点击