printf format

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Thu Dec 21 07:17:46 AEST 1989


In article <987 at nsi.UUCP> javiv at nsi.UUCP (Javier Vilarroig Christensen.) writes:
| In article <5761 at ozdaltx.UUCP> root at ozdaltx.UUCP (root) writes:
| >In the back of my mind, it seems like I read that there is a format
| >character used in printf(C) that allows the formatting of numbers.
| 
| It's imposible to do this with printf. You must make a funtion to do it in
| a string, and then feed it to printf.

  Since I can't read the original poster's mind, I'll take a stab that
he *might* be thinking of the * character, used to specify the width in
an argument evaluated at runtime.

Ex:	n = 14; 		/* set field width */
	printf("Val: %*d sec", n, m);
-- 
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.lang.c mailing list