You can pass character by character to itoa with radix 16.
If you only want to display the hex values, you can use printf with format specifiers %x or %X.
You can pass character by character to itoa with radix 16.
If you only want to display the hex values, you can use printf with format specifiers %x or %X.
I understand how to use the itoa function, but this radix 16?
If you use the radix 10, you will get a string of the an integer in base 10.
For radix 16, you will get a hexadecimal string.
You can try the example in the given web page or the one below.
e.g
Undefined first referenced
symbol in file
itoa /tmp/cc21JKaJ.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Undefined first referenced
symbol in file
itoa /tmp/cc21JKaJ.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
What are you guys taking about? The original request is:
Quote originally posted by sgriffiths ...
how would i go about converting a string value to HEX
ie
char name[10]="STEPHEN";
Convert name to HEX
What does this mean?
1) "STEPHEN" is not a number so it can't be converted to Hex
or
2) "STEPHEN" is a string of characters that each have a Hex value. Do you mean add these characters to get a value?
Maybe an actual example would be in order. After the conversion, what should the Hex value of "STEPHEN" be?
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.