I have a function in a lib that takes a message and variadic parameters and print them like printf. for e.g.:
printMe(const char *fmt,...);
I'm trying to wrap this function. I don't know what is the parameters types and count. I've trying to do it like this:
printMeWrapper(const char *message,...)
{
va_list argptr;
va_start(argptr, message);
printMe( message,argptr);
va_end(argptr);
}
But this only prints the first argument. Any idea on how to do this correctly?
You have to create a second printMe function taking a va_list argument, just like there's printf and vprintf:
void printMeVa(const char *fmt, va_list va)
{
...
}
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