[cc lang=”c++”]char numHex[2] = {0x12,0x34};
int numDec = 0;
numDec = numHex[0]; //存入0x12,存放在了低位
numDec = numDec << 8 | numHex[1]; //将0x12移位,0x34存入低位 cout << numDec << endl;[/cc]
[cc lang=”c++”]char numHex[2] = {0x12,0x34};
int numDec = 0;
numDec = numHex[0]; //存入0x12,存放在了低位
numDec = numDec << 8 | numHex[1]; //将0x12移位,0x34存入低位 cout << numDec << endl;[/cc]