Here's what I tried... but failed:
void testfunc(...){
printf(...);
}
This will create a function that is equivalent to printf
. Note that you cannot blindly print out arguments, since you somehow need to know what type each argument is in advance. The format
argument to printf informs it what arguments to expect and what types they will be.
#include <stdargs.h>
void testfunc(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With