I’m using va_list, va_start, va_end to play with printf-like functions.
void test(char* format, ...)
{
va_list argp;
va_start(argp, format);
vprintf(format, argp);
va_end(argp);
}
Now I wonder how can I write all those parameters to file like fwrite() -> vfwrite() or something. Is there a way without implementing my own fwrite function that can write variable number of parameters ?
Yes, you want
vfprintf().It’s just like
vprintf()but it accepts aFILE *as its first argument.