I have a function which has a variable number of arguments. So I use
stdarg.h and va_start, va_arg and va_end to access the arguments. This works
fine. The problem is that I need a wrapper around this function. So this
function also makes use of va_start, va_arg and va_end.
So now comes the hard part (for me), I need to pass all the arguments to the
function call of the original function. In my enthousiasm I wirst did it
wrapper(int ref, ...)
of course this doesn't work because I then pass the address of the firstQuote:}
argument to the wrapper as an argument to the original function. But the
original function expects the data itself. So my problem is how do I get the
actual data to be copied to the right way. I was thinking of memcpy some
stuff, but I don't know what I should memcpy, and I think it will not be
portable at all. And it would be nice if there is a portable solution for
I could use an array as an argument which contains the data in stead of
using variable arguments, but that is not what I want. It is very anoying to
put all your arguments in an array before you can call your function.
Does anybody has a solution for this?