Member function with variables parameters

M

Marc Leclerc

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
 
M

Marc Leclerc

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);
}
 
A

Alexander Grigoriev

Make sure your function is not inline. Some compilers (older GCC) may have
problems with it.
 
W

White Wolf

Buster said:
I thought it was quite a good joke, for a sig.

I have enough to read. This guy has just declared that he has no intention
to keep the common rules of posting here. He has just declared that he does
not give a d...ime. That sig is rather a flame-bait than any kind of good
joke. I may be unable to make one (good joke), but I know when I see one.
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top