forward argument list from a c++ class member function to a c function, (a wrapper I am creating)
not sure if it is correct? look in the comment inside argsPrinter
// c++ a class function
void argsPrinter( const char *format , ... ){
//markFile(&mApiObj, format , ...); how to pass forward the ... to the c function
/*
va_list args;
va_start (args, format);
markFile(&mApiObj, format , args);
va_end(args);
*/
}
// c function
void markFile(someCustomApi* a, const char *format , ...)
{
FILE *file= fopen(a->somePath, "a");
if(file)
{
va_list args;
va_start (args, format);
vfprintf(file, format, args);
va_end (args);
fclose(file);
}
//else do nothing
}
Edit the implementation changed, however, I may consider implementing an aditional function, if forward is not allowed to the ...
as markFile(&mApiObj, format , ...);