Connecting Tech Pros Worldwide Forums | Help | Site Map

Member function with variables parameters

Marc Leclerc
Guest
 
Posts: n/a
#1: Jul 19 '05
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



Marc Leclerc
Guest
 
Posts: n/a
#2: Jul 19 '05

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]


Alexander Grigoriev
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Member function with variables parameters


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

--
A: People bitching about top posting
Q: What's the most annoying thing on USENET?


"Marc Leclerc" <mleclerc@signel.ca> wrote in message
news:s0o8b.6449$k81.621362@news20.bellglobal.com.. .[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]


Kevin Goodsell
Guest
 
Posts: n/a
#4: Jul 19 '05

re: Member function with variables parameters


Alexander Grigoriev wrote:
[color=blue]
> Make sure your function is not inline. Some compilers (older GCC) may have
> problems with it.
>[/color]

You have been asked several times to stop top-posting. Why do you
continue to do it?

Please read section 5 of the FAQ for posting guidelines:

http://www.parashift.com/c++-faq-lite/

More reading:

http://www.dickalba.demon.co.uk/usen.../faq_topp.html
http://www.cs.tut.fi/~jkorpela/usenet/brox.html

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

White Wolf
Guest
 
Posts: n/a
#5: Jul 19 '05

re: Member function with variables parameters


"Alexander Grigoriev" <alegr@earthlink.net> wrote:[color=blue]
> --
> A: People bitching about top posting
> Q: What's the most annoying thing on USENET?[/color]

*PLONK*


White Wolf
Guest
 
Posts: n/a
#6: Jul 19 '05

re: Member function with variables parameters


Kevin Goodsell wrote:[color=blue]
> Alexander Grigoriev wrote:
>[color=green]
>> Make sure your function is not inline. Some compilers (older GCC)
>> may have problems with it.
>>[/color]
>
> You have been asked several times to stop top-posting. Why do you
> continue to do it?
>
> Please read section 5 of the FAQ for posting guidelines:
>
> http://www.parashift.com/c++-faq-lite/
>
> More reading:
>
> http://www.dickalba.demon.co.uk/usen.../faq_topp.html
> http://www.cs.tut.fi/~jkorpela/usenet/brox.html[/color]

Also a tool for Microsoft Outlook Express users:

http://home.in.tum.de/~jain/software/oe-quotefix/

--
WW aka Attila


Buster Copley
Guest
 
Posts: n/a
#7: Jul 19 '05

re: Member function with variables parameters


White Wolf wrote:[color=blue][color=green]
>>--
>>A: People bitching about top posting
>>Q: What's the most annoying thing on USENET?[/color]
>
> *PLONK*[/color]
I thought it was quite a good joke, for a sig.

White Wolf
Guest
 
Posts: n/a
#8: Jul 19 '05

re: Member function with variables parameters


Buster Copley wrote:[color=blue]
> White Wolf wrote:[color=green][color=darkred]
>>> --
>>> A: People bitching about top posting
>>> Q: What's the most annoying thing on USENET?[/color]
>>
>> *PLONK*[/color]
> I thought it was quite a good joke, for a sig.[/color]

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.
:-)

--
WW aka Attila


Kevin Goodsell
Guest
 
Posts: n/a
#9: Jul 19 '05

re: Member function with variables parameters


White Wolf wrote:
[color=blue]
> "Alexander Grigoriev" <alegr@earthlink.net> wrote:
>[color=green]
>>--
>>A: People bitching about top posting
>>Q: What's the most annoying thing on USENET?[/color]
>
>
> *PLONK*
>
>[/color]

I didn't notice that before, or I wouldn't have bothered with my reply.
I'll also be adding him to my killfile now.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Closed Thread