Hi,
Given the following function:-
void foo (char *fmt, ...) {
}
I know how to use va_start, va_end etc to process the parameters but is
there an easy way of passing the parameter list onto another function
that also has variable length arguements.
So for example given the function
void bar (char *fmt, ....) {
}
can I call bar from foo such as
void foo (char *fmt, ...) {
bar (fmt, <what goes here>);
}
Thanks
Andy 3 1739 ju**@andy-coleman.co.uk wrote: Hi,
Given the following function:-
void foo (char *fmt, ...) { }
I know how to use va_start, va_end etc to process the parameters but is there an easy way of passing the parameter list onto another function that also has variable length arguements.
This is Question 15.12 in the comp.lang.c Frequently
Asked Questions (FAQ) list http://www.eskimo.com/~scs/C-faq/top.html
-- Er*********@sun.com ju**@andy-coleman.co.uk wrote: Hi,
Given the following function:-
void foo (char *fmt, ...) { }
I know how to use va_start, va_end etc to process the parameters but is there an easy way of passing the parameter list onto another function that also has variable length arguements.
So for example given the function
void bar (char *fmt, ....) { }
can I call bar from foo such as
void foo (char *fmt, ...) { bar (fmt, <what goes here>); }
Thanks Andy
No. You should call the function bar with a va_list from function foo.
Krishanu
In article <cu**********@news1brm.Central.Sun.COM>,
Eric Sosman <er*********@sun.com> wrote:
ju**@andy-coleman.co.uk wrote: Hi,
Given the following function:-
void foo (char *fmt, ...) { }
I know how to use va_start, va_end etc to process the parameters but is there an easy way of passing the parameter list onto another function that also has variable length arguements.
This is Question 15.12 in the comp.lang.c Frequently Asked Questions (FAQ) list
http://www.eskimo.com/~scs/C-faq/top.html
The short summary of which is: No. That's why the v*printf() functions
exist. I.e., you have to provide v* versions of your functions that accept
va_arg type args (rather than the usual list of args). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kevin Lyons |
last post by:
Hello,
I am trying to get my select options (courses) passed correctly from
the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html
I am having difficulty getting the...
|
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) {...
|
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of...
|
by: truckaxle |
last post by:
I am trying to pass a slice from a larger 2-dimensional array to a
function that will work on a smaller region of the array space. The
code below is a distillation of what I am trying to...
|
by: |
last post by:
Hi,
1st, I did a search and could not find any info on this, the Google results
were good, but I'm still have issues...So any help will be great.
I have a frame page, which contains 3 frames...
| |
by: ged |
last post by:
Hi,
i am a oo (c#) programmer, and have not used javascript for a while and
i cant work out how javascript manages its references. Object
References work for simple stuff, but once i have an...
|
by: Andrew Bullock |
last post by:
Hi,
I have two classes, A and B,
B takes an A as an argument in its constructor:
A a1 = new A();
B b = new B(a1);
|
by: satterfieldben |
last post by:
I have a newbie question about passing variables between functions. I am wanting to use a drop down box to select a value. Then base on which was selected, it would create a variable and I would...
|
by: satterfieldben |
last post by:
I have a newbie question about passing variables between functions. I am wanting to use a drop down box to select a value. Then base on which was selected, it would create a variable and I would call...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |