[KLUG Programming] Passing on variable argument lists.

Adam Williams programming@kalamazoolinux.org
Sun, 08 Feb 2004 14:03:07 -0500


In C you can define a function to take a variable argument list like -
xmlrpc_client_call_server (xmlrpc_env *env,
                           xmlrpc_server_info *server,
                           char *method_name,
                           char *args_format,
                           ...);
- which in essence means there are as many "char *args_format"s as there
needs to be;  and the function iterates through them.

I'm curious how you can 'pass on' a variable argument list;  say have a
function that takes one and then passws it it another, like -

char* foobar(char* param1, char* param2, char* moreparams, ....) {
 ...blah...blah
  xmlrpc_client_call_server (xmlrpc_env *env,
                             xmlrpc_server_info *server,
                             param2,
                             moreparams);
 ...blah...blah
 return ...
}

Would that work?   Would xmlrpc_client_call_server accept "moreparams"
as a bunch of arguments or would the ellipses-ness have been lost?