16进制unsigned char*转char*
时间: 2023-06-03 07:05:06 浏览: 124
十六进制转字符
可以使用memcpy函数将unsigned char*转换为char*,代码示例:
```
unsigned char* hex_str = "54686973206973206120686578616465632e";
char* str = new char[strlen((char*)hex_str) / 2 + 1];
for (int i = 0; i < strlen((char*)hex_str); i += 2) {
sscanf((char*)(hex_str + i), "%2hhx", str + i / 2);
}
str[strlen((char*)hex_str) / 2] = '\0';
```
阅读全文