I'm having trouble understanding the docs on this. From what I could tell, it seemed like both of these should work: writef("%.2X", myByte); writef("%02X", myByte); But both of them just simply print the format string as-is.