Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old July 19th, 2005, 06:26 PM
Marc Leclerc
Guest
 
Posts: n/a
Default Member function with variables parameters

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


  #2  
Old July 19th, 2005, 06:26 PM
Marc Leclerc
Guest
 
Posts: n/a
Default 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]


  #3  
Old July 19th, 2005, 06:27 PM
Alexander Grigoriev
Guest
 
Posts: n/a
Default 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]


  #4  
Old July 19th, 2005, 06:27 PM
Kevin Goodsell
Guest
 
Posts: n/a
Default 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.

  #5  
Old July 19th, 2005, 06:29 PM
White Wolf
Guest
 
Posts: n/a
Default 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*


  #6  
Old July 19th, 2005, 06:29 PM
White Wolf
Guest
 
Posts: n/a
Default 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


  #7  
Old July 19th, 2005, 06:29 PM
Buster Copley
Guest
 
Posts: n/a
Default 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.

  #8  
Old July 19th, 2005, 06:29 PM
White Wolf
Guest
 
Posts: n/a
Default 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


  #9  
Old July 19th, 2005, 06:29 PM
Kevin Goodsell
Guest
 
Posts: n/a
Default 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.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.