473,473 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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
Jul 19 '05 #1
8 3328
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);
}
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

Jul 19 '05 #2
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" <ml******@signel.ca> wrote in message
news:s0*******************@news20.bellglobal.com.. .
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

Jul 19 '05 #3
Alexander Grigoriev wrote:
Make sure your function is not inline. Some compilers (older GCC) may have
problems with it.


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.

Jul 19 '05 #4
"Alexander Grigoriev" <al***@earthlink.net> wrote:
--
A: People bitching about top posting
Q: What's the most annoying thing on USENET?


*PLONK*
Jul 19 '05 #5
Kevin Goodsell wrote:
Alexander Grigoriev wrote:
Make sure your function is not inline. Some compilers (older GCC)
may have problems with it.


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


Also a tool for Microsoft Outlook Express users:

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

--
WW aka Attila
Jul 19 '05 #6
White Wolf wrote:
--
A: People bitching about top posting
Q: What's the most annoying thing on USENET?


*PLONK*

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

Jul 19 '05 #7
Buster Copley wrote:
White Wolf wrote:
--
A: People bitching about top posting
Q: What's the most annoying thing on USENET?


*PLONK*

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

--
WW aka Attila
Jul 19 '05 #8
White Wolf wrote:
"Alexander Grigoriev" <al***@earthlink.net> wrote:
--
A: People bitching about top posting
Q: What's the most annoying thing on USENET?

*PLONK*


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.

Jul 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
31
by: Ben | last post by:
For many times, I've found myself changing my member variables from const back to non-const. No matter how good the original objective was, there was always at least one reason not to use const...
9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
37
by: Joergen Bech | last post by:
(Slightly religious question): Suppose I have the following class: ---snip--- Public Class MyClass Private _MyVariable As Integer Public Property MyVariable() As Integer Get
60
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
3
by: ryan.mitchley | last post by:
Hi all I have a class (cPort) that is designed to receive objects and, depending on the type, call a handler (callback) in any descendant of a cProcessBlock class. Callback functions take a...
8
by: David Veeneman | last post by:
Should a member variable be passed to a private method in the same class as a method argument, or should the method simply call the member variable? For years, I have passed member variables to...
15
by: Bob Johnson | last post by:
I have a base class that must have a member variable populated by, and only by, derived classes. It appears that if I declare the variable as "internal protected" then the base class *can*...
13
by: JohnQ | last post by:
The implementation of classes with virtual functions is conceptually easy to understand: they use vtables. Which begs the question about POD structs: how are they associated with their member...
6
by: subramanian100in | last post by:
why can't a static member function be declared as const ? We can declare a non-static member function as const, to indicate that it does not modify the non-mutable data members. In the same way, is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.