Passing Variable Numbers of Arguments

David Young dyoung at media-lab.MEDIA.MIT.EDU
Tue Feb 12 08:59:45 AEST 1991



I'd like to be able to write a macro or a function that will take an
unspecified number of arguments -- similar to how the printf() function
works.  What I'd like is something that could transform a call like:

     PringMsg( window, formatString, <formatArgs>)

into the following chunk of code:

     { 
       sprintf( globalFoo, formatString, <formatArgs>);
       BlahBlah( window, globalFoo);
     }

I was hoping to find something similar to the &rest capability of Lisp.
But am scared I'll have to end up using vprintf().

Can anyone help or offer a suggestion or solution?

Thanks,

david young



More information about the Comp.lang.c mailing list