#Variable Arguments
28-Sep-90 17:54:12
Sb: #1191-#Variable Arguments
Fm: Mike Spille/Manx 71545,1466
To: LANCE SHORB 76177,3261
Try this:
void testf (str, …) char *str; /* I prefer to use ANSI syntax BTW, even
though its ugly */ {
va_list arg;
va_start (arg, str);
vprintf (str, arg);
va_end (arg); }
The main point is use of vprintf instead of printf. There's a big
difference between a function which takes a variable number of arguments,
like printf:
int printf (const char *format, …);
and a function which takes a variable argument list, like vprintf:
int vprintf (const char *format, va_list arg);
Let me know if you have anymore questions.
-Mike