printf( "%#04x", 1 )

Doug Gwyn (ACISD/MCSB) uunet!BRL.MIL!gwyn
Fri Feb 25 12:22:43 PST 1994


The field width includes the leading "0x".
(At least it does for the implementation on which the fprintf spec
was modeled.)  So how do we read the spec to require this?  I think
it's evident where field width is first described: "If the converted
value has fewer characters than the field width, it will be padded
by spaces ..."  The emphasis on *characters* and on left or right
padding seems to strongly imply that 0x, e+99, ., etc. are all part
of the field width.



More information about the Numeric-interest mailing list