guys,
Can somebody help me with a Unix 'C' program, to convert the Hexa decimal value to binary value.
Thank you
Cheers
S
guys,
Can somebody help me with a Unix 'C' program, to convert the Hexa decimal value to binary value.
Thank you
Cheers
S
Homework? What exactly are the requirements? Just output 1s and 0s?
I'd start with some consistency checks on the input (even number of characters, all between 0 and F), sscanf() 2 characters at a time into an unsigned char, loop over the byte with a bitwise AND, shifting the mask right at every iteration, and output a '1' or '0' as needed. Maybe throw in a blank every 8 bits for better readability.
nope!!! not home work.
actually i want to convert the 0D (Carriage return ) to binary bits. not to the binary ascii values like ( 00001101) but, to some un readable format. Can you please suggest me how i can get this. I am implemeting some HL7 standard which i don't about this.
You mean, like this?
int val;
sscanf("0D", "%02x", &val);