writing a replacement for a function which takes a variable number of parameters (c programming) -
I want to write a function to replace fprintf
int fprintf (FILE * Stream, const char * format, ...);
I'm not sure how to define such a function, because, after the format parameter, this function takes a variable number of parameters. In particular, at least several additional arguments are specified in the format.
UPDATE I have received a resource on the topic (), but the example does not seem like
This is not a homework.
I am just a beginner who is trying to learn how to program in my spare time. Thanks! Instead of calling fprintf
directly
Code> vfprintf for example:
#include
In the standard library, each function that has varargs ( ...
) also has the v
version of the same function in it Sounds like a va_list
parameter. Since you can not create logic for dynamically passing, so you have to use the v
version to pass on varargs.
Comments
Post a Comment