Convert multibyte Hex string to LONG
Posted on 2001-06-26
I have an ActiveX control that sends values to a low level serial device with statements like...
readBuffer = 0xC4010010
where "OxC4..." is the value in question. I can convert the hex to string with sprintf()... I use the text translation to set a property on the ActiveX to be read by the host program which is in Visual Basic. The problem is that now I need to have the ActiveX take a string value back ("0xC4010002") and convert it back to hex to be written to the serial device. I can't figure out how to convert it from string to Hex. I have looked at functions like strtol and so forth, but I am really new to C++ and I can't seem to figure out the syntax.
someone suggested sscanf, but that appears to work only on single byte strings and I have to deal with 32 bit words
If someone could offer a really specific answer I'd be a happy man!
Thanks for your help, you guys are great.