char ch[2]={0x12,0x34};
方法1:uint16_t num = ch[0]<<8+ch[1];
方法2:uint16_t num ;
memcpy(&num,ch,sizeof(num));
num = ntohs(num);
char ch[2]={0x12,0x34};
方法1:uint16_t num = ch[0]<<8+ch[1];
方法2:uint16_t num ;
memcpy(&num,ch,sizeof(num));
num = ntohs(num);