[KLUG Programming] Passing on variable argument lists.
Robert G. Brown
programming@kalamazoolinux.org
Sun, 08 Feb 2004 19:30:51 -0500
On Sun, 08 Feb 2004 17:27:45 -0500, Adam Williams <awilliam@whitemice.org> wrote:
>On Sun, 2004-02-08 at 14:27, Robert G. Brown wrote:
>> I beleive you want the man page for stdarg. These are macros for
>> variable-length parameter lists. Let us know if this is the right thing,
>
>It appears not; va_start/arg/end/copy seems to be for processing
>variable parameter lists in a function, I just want to pass them into a
>'subordinate' function.
How is that not "processing"?
>
>And it appears this can't be done directly -
>
>void ogo_call(char* ogourl,
> char* ogouser,
> char* ogopasswd,
> char* ogocall,
> char* ogoargs,
> ... ) {
>...blah...blah...
> results = xmlrpc_client_call_server(&env, server,
> ogocall,
> ogoargs);
>
>- results in a segmentation fault (although it obviously compiles OK).
Right, it can't be done directly. That is what I understand the var_args stuff
is for. AFAIK, it's used to write things like printf, which has the same
syntax that I think you want to use... extensible, or variable paramter lists).
>The function is called like -
>
>ogo_call(ogourl, ogouser, ogopasswd, ogocall,
> "({s:{s:8,s:8}})",
> "qualifier",
> "startDate","20030801T00:00:00",
> "endDate","20040831T23:59:59");
>
>- and if I put those static values directly into the
>xmlrpc_client_call_server call the little program happilly enumerates
>all my appointments between Aug 2003 & Aug 2004.
>
>Grrrr.
Welcome to static, strong datatyping! :)
Regards,
---> RGB <---