I have a function with a printf-like variable parameter list that I call for example with:
debugMsg(__FILE__, __LINE__, "failed with var %s = %d\n", var, val);
Now I need a wrapper function for this, e.g.:
void debugMsgWrapper(const char* FileName, int LineNo, const char* FmtStr, ...)
{
// do some other things
DebugMsg(FileName, LineNo, FmtStr, ...);
}
Of course this doesn't work with the parameter list specified as ...
but I don't have any idea how to copy the parameter list to the called function. I had a look at
void va_copy(va_list dest, va_list src);
but could not find how to use it.
How can I give the variable parameter list to the called function?