If I have a character like the following:
wchar_t c = '\x0A'
What's an easy way to convert it so that it becomes something like:
wchar_t dst[] ==> "0A"
Basically, the hex value of c becomes a string value.
If I have a character like the following:
wchar_t c = '\x0A'
What's an easy way to convert it so that it becomes something like:
wchar_t dst[] ==> "0A"
Basically, the hex value of c becomes a string value.
The integral value of
c
would be0x0A
(10
in base 10). You can usesprintf
to format it as hex:Note the intermediate
c_val
variable is not needed, only added for clarityor you can do it manually:
A simple hexifier can be written quite easily. This one takes the target string as an input parameter:
Usage: