Hi I'd like to write a macro for the function with a variable argument, for
example
#define PrivateLog(szFormat,...) PublicLogWrite(_TODAY_,szFormat,...)
// where _TODAY_ is a static string containing e.g. "May 23, 2007"
void PublicLogWrite( char *szToday, char *szFmt, ... )
{
va_list arglist;
va_start( arglist, szFmt );
// ... e.g. vsprintf()
va_end( arglist );
// ... e.g. fprintf()
}
so the caller should look like,
PrivateLog( "Error:%s ReturnCode=%d", szErrorMessage, nError );
PrivateLog( "Info:%s Len=%d #Lines=%d", szInfoMessage, nLen, nNumLines );
But those 2 lines generates the compilation errors:
error C2059: syntax error : '...'
Anyone knows how to resolve this?
TIA.