|go ahead... be a heretic|
Re: Printing byte as 2 Hex charactersby ikegami (Pope)
|on May 30, 2012 at 15:38 UTC||Need Help??|
[ I went sideways a bit since this is a learning exercise. Hopefully, this will put you in the right mindset to solve similar problems in the future. ]
This alone isn't very clear.
Is your input the string 0b11110000, the number 0b11110000 (240) or the character 0b11110000 (240)?
Is your desired output the string 0xF0, the number 0xF0 (240) or the character 0xF0 (240)?
One would generally convert the input to a number,
do something with it, then format the number as desired.
Looking at your code, you want the the string 0xF0 from character 0b11110000, so