O
Old Wolf
#include <stdio.h>
#include <stdarg.h>
Is this safe:
void foo(const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
vprintf(fmt, ap);
va_end(ap);
va_start(ap,fmt);
vprintf(fmt, ap);
va_end(ap);
}
Supposing it is, how can you re-use the list in this case:
void bar(const char *fmt, va_list ap)
{
vprintf(fmt, ap);
/* ? */
vprintf(fmt, ap);
va_end(ap);
}
where bar() is called by something like:
void baz(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
bar(fmt, ap);
}
#include <stdarg.h>
Is this safe:
void foo(const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
vprintf(fmt, ap);
va_end(ap);
va_start(ap,fmt);
vprintf(fmt, ap);
va_end(ap);
}
Supposing it is, how can you re-use the list in this case:
void bar(const char *fmt, va_list ap)
{
vprintf(fmt, ap);
/* ? */
vprintf(fmt, ap);
va_end(ap);
}
where bar() is called by something like:
void baz(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
bar(fmt, ap);
}