printf zero-pads strings?
Chris Torek
chris at mimsy.umd.edu
Mon Oct 23 00:09:39 AEST 1989
In article <7279 at sdcsvax.UCSD.Edu> williams at beowulf.ucsd.edu
(Paul Williamson) writes:
> printf("%05s", "x");
>According to my old draft spec, and several compilers, this should print
>"0000x". That is, it should pad the string on the left with zeroes. But
>K&R2 and several other compilers give " x", claiming that zero-padding
>applies only to numeric values.
(K&R2 is not a compiler.)
The 4.4BSD doprnt.c (essentially the one I posted to comp.lang.c) prints
"0000x". This appears to conform to the letter of the standard (we wrote
the thing based on the letter of the standard!).
--
`They were supposed to be green.'
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.std.c
mailing list