#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned int cmd = 0xffcb;
unsigned char buf[2] = {0};
unsigned int tmp;
buf[0] = cmd >>8;
buf[1] = cmd;
printf("%02X %02X \n",buf[0], buf[1]);
tmp = (buf[0] << 8) + buf[1];
printf("%d \n",tmp);
return 0;
}
运行结果:
root@ubuntu:/home/# ./test
FF CB
65483
root@ubuntu:/home/#