printf("%#02bx",0xff); The above line of code does what I'd expect, ie it prints out "0xff". However, printf("%#02bx",0x00); prints out "0x000000000000000"..... for a very long time. The same happens for any value between 0x00 and 0x0f, 0x10 to 0xff work as expected. Is this a bug or am I being stupid? I'm using C51 V7.
I've tried it on C51 v6.23a and Borland C++ Builder v5. Borland is fine, but C51 behaves as you describe. I wonder if it's because you have specified the field width as 2, but also specified that "0x" is to be added - presumably you actually want a field width of 4, to hold "0xnn"?