J
joecook
I thought I could have a wrapper over a function that takes a variable
argument list, but it doesn't work. (it compiles, but does not produce
expected results) Anything pop out?
#include <iostream>
#include <cstdarg>
using namespace std;
void foo(const char* fmt, ...)
{
va_list ap;
va_start(ap,fmt);
printf(fmt,ap);
va_end(ap);
}
int main()
{
foo("This is a number: %d",44);
}
Thanks,
Joe C
argument list, but it doesn't work. (it compiles, but does not produce
expected results) Anything pop out?
#include <iostream>
#include <cstdarg>
using namespace std;
void foo(const char* fmt, ...)
{
va_list ap;
va_start(ap,fmt);
printf(fmt,ap);
va_end(ap);
}
int main()
{
foo("This is a number: %d",44);
}
Thanks,
Joe C