| re: Member function with variables parameters
Sorry, posted the function in C as I tested if it had something to do with
the code being a class member
void CDmsLog::CreateEntry (const char *format, ...)
{
va_list arglist;
char szLine[100];
EnterCriticalSection(pcsLog);
va_start(arglist, format);
sprintf(szLine, format, arglist);
va_end(arglist);
DoCreateEntry(szLine);
LeaveCriticalSection(pcsLog);
}
[color=blue]
> Would anyone have a hint of what's wrong with this
>
>
> static char szLocalInternetAddress[16];
> DWORD dwTest = 0x0002;
>
> g_DmsLog.CreateEntry("Test with DWORD: %ld", dwTest);
> g_DmsLog.CreateEntry("System IP: %s ", szLocalInternetAddress);
>
>
>
> void CCreateEntry (const char *format, ...)
> {
> va_list arglist;
> char szLine[100];
>
> va_start(arglist, format);
> sprintf(szLine, format, arglist);
> va_end(arglist);
>
> g_DmsLog.CreateEntry(szLine);
>
> }
>
> The arglist points to nowhere good.
>
> Thanks
>
>[/color] |