Say I have a const char* that equals "10". How would I go about
turning that into '\x10'? I've tried itoa and ssprintf or something,
and have been at it for an entire day but I can't figure it out.
This will convert the string to an unsigned long, assuming the input
is in hexadecimal:
unsigned long value = strtoul("10", NULL, 16);
Printing that value back out in hexadecimal with a leading '0x' looks
something like:
std::cout << std::hex << std::showbase << value << "\n";
--
Later,
Jerry.
WOW THANK YOU, this is a life saver. Perfect.