Click to See Complete Forum and Search --> : Hex conversion


Maria
April 14th, 1999, 10:58 AM
I need to convert string "A1A2A3A4" to "\xA1\xA2\xA3\xA4"
and "\xA1\xA2\xA3\xA4" to "A1A2A3A4".

I can do this by splitting string "A1A2A3A4" on "A1" "A2" "A3" "A4"
and then passing to strtol("0xA1", &stopstring, 16);
The result added to string. Is it possible to do this using sscanf and sprintf.


Thank you for any better idea.


Maria F. Kornievskaya

delbert Harry
April 14th, 1999, 11:32 AM
What exactly do you mean by "\xA1 ....."
Are you trying to convert from one base to another?

Maria
April 14th, 1999, 11:34 AM
Yes. I've done this. But I believe that there is a simplier decision with sscanf and sprintf functions using.

Have you used them for this purpose?

Maria F. Kornievskaya