#include <string>
string hex_to_str(uint16_t mask,int len){
//16进制字符集
string hexes[16] = {"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"};
string hexstring = "";
for (int i=0; i<len; i++){
int j = len-i-1;
//按顺序取4bit数
int number = (mask >> 4*j) & 0xf;
hexstring += hexes[number];
}
return "0x" + hexmask;
}
02-24
1656
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-16
1159
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)