I convert a char* into hex string with this code
char const hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B','C','D','E','F' };
std::string hex_str;
for (int i = 0; i < byte_received; ++i)
{
const char ch = data[i];
hex_str.append(&hex[(ch & 0xF0) >> 4], 1);
hex_str.append(&hex[ch & 0xF], 1);
}
how can i get a reverse conversion from hex string to original data?