print format

Roger G Desroches II rgd at uunet!unhd
Fri Aug 3 02:26:51 AEST 1990


Is there a way to specify the format in a print statement with a variable.
What I want to do is print out a group of strings so they are all right
justified on the right side with the largest string.  (example)

	format = sizeof(largest_string);
	for (i=0;array[i];i++)
		printf("%[format]s\n",array[i]);
			     ^^^^^^^^
				 this is what I want to do.

I realize I can write a routine to do this, but I am going to be doing it
quite a bit and would like to keep the CPU time down to a minimum. Does anyone
have any ideas?         
						Thank you.


-- 
            /                                    | . .  . .  o o  . .  . . 
xxxxxxxxxxx|rgd at unhd.unh.edu######>              |  ^    ^    ^    ^    ^
	    \                                    | ---  ---  \_/  ---  ---
"Never let an inanimate object throw you" - me.  |       Never Follow    



More information about the Comp.lang.c mailing list