Search code examples
chexprintfpretty-print

Printing char values in hex inside a 1-character square in C?


In C, is it possible to force an unsigned char to print as a hex, not with %x, but in the little square box that displays the four hex numbers, but only takes up one character, for example ?


Solution

  • No, it is not possible.

    This is not related to C, but to the font your terminal uses. C outputs characters as bytes; your terminal is responsible for choosing how to display them as pixels. (You might as well ask how to make the text italic.)