Summary: Converting ascii hex to pure hex values
Mark Pledger
mpledger at cti1.UUCP
Fri Oct 26 21:02:42 AEST 1990
I sure caused alot of traffic for this little question.
Thanks to everyone who responded.
I guess I did'nt make myself clear enough on my question though. I know I
can use scanf() or cast a char to int (for a single char). I DID'NT want to
use scanf() and casting does not work for my question. The original question
went something like this: If you have a character string with the ascii
representation of hex values (e.g. s[] = "63", which will be stored as TWO
hex byte values \x9 & \x9. I only want to store them as ONE hex byte of \x63.
Without using scanf() (or even sprintf()) what is the best (fasted for me) way
to convert a two-digit ascii code to a one digit hex code, so I can put it back
into the charater string s[], append a null, and write it back out to disk. I
currently use atoi() and just write out the int to disk. I am interested in
creating (or finding) a routine that will take a character string as the
argument, and returning the hex result in the same character string.
Any suggestions?
--
Sincerely,
Mark Pledger
--------------------------------------------------------------------------
CTI | (703) 685-5434 [voice]
2121 Crystal Drive | (703) 685-7022 [fax]
Suite 103 |
Arlington, DC 22202 | mpledger at cti.com
--------------------------------------------------------------------------
More information about the Comp.lang.c
mailing list