Article View: comp.std.c
Article #824Re: printf zero-pads strings?
From: Chris Torek
Date: Sun, 22 Oct 1989 14:09
Date: Sun, 22 Oct 1989 14:09
17 lines
1195 bytes
1195 bytes
In article <7279@sdcsvax.UCSD.Edu> williams@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@cs.umd.edu Path: uunet!mimsy!chris
Technical Details
Message-ID:
<20327@mimsy.umd.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ames!dftsrv!mimsy!chrisReferences:
<7279@sdcsvax.UCSD.Edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ames!dftsrv!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.std.c Subject: Re: printf zero-pads strings? Message-ID: <20327@mimsy.umd.edu> Date: 22 Oct 89 14:09:39 GMT References: <7279@sdcsvax.UCSD.Edu> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 17