16进制转字符方法-MS

 

static const char hexToASCII[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

result->s[pos++] = hexToASCII[(source[i] & 0xF0) >> 4]; /*high nibble*/
result->s[pos++] = hexToASCII[source[i] & 0x0F]; /*low nibble*/

posted @ 2020-03-26 11:33  chua052  阅读(538)  评论(0编辑  收藏  举报