VC++中,如何在返回的指令中提取出16进制的数据,并把它在另一个编辑框中以10进制输出?跪求!急急急!

来源:百度知道 编辑:UC知道 时间:2024/05/04 22:17:24
我给20分哦!
我现在的程序代码:
收到的指令为:c9 f2 06 00 00 88 00 90 12 00 bd
strContent=m_strDataReceived.Left(17);
stre= strContent.Right(2);
char *temp=(char*)((LPCTSTR)stre);
char buf[1];
buf[0]=temp[0];
buf[1]=temp[1];
如何将提取出来的 16进制的 88 转换成 10进制的数?
float f=atof(buf);
m_dian1=f/2000;

strContent=m_strDataReceived.Right(21);
stre= strContent.Left(5);
char* p = (char*)(LPCTSTR)stre;
char buf[3];
buf[0]=p[0]; buf[1]=p[1];buf[2]=p[3]; buf[3]=p[4];
float f=hextodec(buf);
char temp1[10];
sprintf(temp1,"%f",f);
str1 = temp1;
m_dian1=f/2000;

int nResult = (int) ( ( buf[0] << 4 ) | buf[1] );