3B1 C runtime library bug; do you have it too?
Bruce Lilly
bruce at balilly.UUCP
Sun Jan 6 04:48:29 AEST 1991
In article <37567 at cup.portal.com> thad at cup.portal.com (Thad P Floryan) writes:
>
>All 3B1 systems I have here (with 3.5 & 3.5 dev. set and 3.51m w/3.51 dev set)
>produce the (incorrect) results:
>
> *.*f
> 1.230
> printf ("%0*.*f\n", p+3, p, frac);
> printf ("%*.*f\n", p+3, p, frac);
It's not clear that this is, in fact, ``incorrect.'' From the printf(3S)
man page:
``A field width or precision or both may be indicated by an asterisk (*)
instead of a digit string.''
^^^^^^^^^^ N.B. it doesn't say ``in addition to.''
If you really need the '0' (to pad on the left with zeros), I suggest
generating a format string using sprintf, e.g.
char fmt[30]; /* set size to taste */
...
sprintf(fmt, "%%0%d.%df\n", p+3, p)
printf(fmt, frac);
...
If the "%0*.*f" happens to do want you want on other systems, that doesn't
mean that that (unspecified) behaviour is ``standard.''
Good luck with your project.
--
Bruce Lilly blilly!balilly!bruce at sonyd1.Broadcast.Sony.COM
More information about the Comp.sys.att
mailing list