"%02d" vs "%.2d"

Chris Torek chris at mimsy.UUCP
Sun Jan 29 13:44:06 AEST 1989


In article <13368 at ncoast.ORG> allbery at ncoast.ORG (Brandon S. Allbery) writes:
>One other reason as well:  it's not possible to get zero padding when using
>variable width fields (%*d) under the old scheme.

	printf("%0*d", width, value)

works fine.  (`Note that 0 is a flag, not a field width'....)

(Of course, there may be any number of implementations that got this wrong.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list