C++ help needed -->

KMurphy

Golden Member
May 16, 2000
1,014
0
0
I need to know if there is a function or class that can display data packets taken from a serial port in hexadecimal.

Currently, all my data is coming out ASCII and I can't re-convert to hex. The data must be initially output in hex.
 

PowerJoe

Senior member
Oct 9, 1999
887
0
0
Converting ASCII to hex is not that difficult:

char HexDigits[]="0123456789ABCDEF";

void PrintHex(char x)
{
printf("%c%c", HexDigits[x >> 4], HexDigits[x & 0x0F]);
}


-PJ