By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,261 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,261 IT Pros & Developers. It's quick & easy.

passing varargs to another function

P: n/a
Hi,

I want to write a varargs function which then passes its parameters to
another varargs function. I have RTFFAQ:

http://www.eskimo.com/~scs/C-faq/q15.12.html

which says that the other function should accept a va_list pointer to do
this. However, I can't seem to get this answer working.

Would someone mind posting a simple example of how this can be done?

Many thanks in advance,
Ian
Nov 14 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
begin followup to Ian Partridge:
Would someone mind posting a simple example of how this can be done?


http://www.google.at/search?q=exampl...va_list+va_arg

=>

http://www.qnx.com/developer/docs/mo.../v/va_arg.html

--
Für Google, Tux und GPL!
Nov 14 '05 #2

P: n/a
Ian Partridge <i.*********@DIESPAM.uk.ibm.com> wrote:
# Hi,
#
# I want to write a varargs function which then passes its parameters to
# another varargs function. I have RTFFAQ:

static void plover(int x,...) {va_list L; va_start(L,x); etc;}
static void plugh(int x,...) {va_list L; va_start(L,x); plover(x,L); etc;}

This won't work. You need a version of plover that accepts a va_list.

static void vplover(int x,va_list L) {...}
static void plover(int x,...) {va_list L; va_start(L,x); vplover(x,L);}
static void plugh(int x,...) {va_list L; va_start(L,x); vplover(x,L); etc;}

# which says that the other function should accept a va_list pointer to do
# this. However, I can't seem to get this answer working.
#
# Would someone mind posting a simple example of how this can be done?

--
Derk Gwen http://derkgwen.250free.com/html/index.html
One of the drawbacks of being a martyr is that you have to die.
Nov 14 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.