not sure if using the variable arg list saves me any work, so i ended up writing a function that builds the format string. in my case i wanted tab separated scientific notation:
insert
Code:
int main(void)
{
double a = 1.0, b = 2.0, c = 3.0;
int n_vars = 3, min_field_width = 15, n_dec_pts = 6;
printf(tab_sep_sci(n_vars, min_field_width, n_dec_pts), a, b, c);
return 0;
}
char *tab_sep_sci(int n, int min_field_width, int n_decimal)
{
char *format = NULL;
char *field = NULL;
int i;
sprintf(field, "%%%d.%de\t", min_field_width, n_decimal);
for(i=0; i<n; i++) strcat(format, field);
strcat(format, "\n");
return format;
}