Hello,
Visual Studio 2008
I am using the following source code that compiles ok using linux gcc 4.4.1.
However, I am trying to compile on windows xp sp3 using VS 2008 compiling as c code.
I get a run-time error on the call to vfprintf. And also the __func__
gives me a compile error. "Undeclared identifier". I thought __func__
was defined in the stdarg.h file.
Many thanks for any advice,
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
void log_msg(FILE *out, const char *fmt, ...);
int main(void)
{
printf("== Start program ===\n");
log_msg(stderr, "[ %s ] : [ %s ] : [ %d ]\n", __FILE__, __func__, __LINE__);
return 0;
}
void log_msg(FILE *out, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(out, fmt, ap); /* run-time error here */
va_end(ap);
}