Vic wrote:
> I would like to calculate the min width at
> run-time, e.g. printf(%Wd", i); where W is calculated 
> prior to the
> printf.

The prototype for printf is

  int printf(const char *str,...)

The format specification string str is a string like any 
other, i.e. a zero-terminated array of char. (The const 
qualifier in the prototype refers to the fact that printf 
isn't allowed to change str. The string doesn't have to be a 
literal constant, although it usually is.)

Therefore you can compute str at runtime, e.g.:

  char *str[100];
  /* compute str here */
  printf(str, i);

David

Reply via email to