printf zero-pads strings?

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Tue Oct 24 06:54:33 AEST 1989


In article <11390 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:

|  >K&R2 and several other compilers give "    x", claiming that zero-padding
|  >applies only to numeric values.
|  
|  And that is what we intend.

  And broke every program which used zero fill for strings! I think you
also broke zero fill for left justified data, both strings and numerics.

  Before you write a hot reply, I'm joking. One of the hardest problems
I had to find (someone else's code) was a case where a number was
zerofill, left justified. Naturally we were looking for something in the
code which multiplied by ten every time the value dropped below 100! 

  I actually do have a program which uses zero filled strings and I
will not complain if it breaks, it was a hack and is documented as
such. The program was compiled on VMS2 (yes ten years ago) and has
probably never been recompiled.

-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.std.c mailing list