Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <199906031837.MAA10219@chorus> Date: Thu, 3 Jun 1999 12:37:11 -0600 (MDT) From: "139a80000-HallM(DR3132)37x10" Reply-To: "139a80000-HallM(DR3132)37x10" Subject: Re: stdarg question To: cygwin AT sourceware DOT cygnus DOT com, dyoung AT vviuh221 DOT vvi DOT com X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4m sparc Content-Type: text X-Sun-Text-Type: ascii > I have a function using the stdarg facility such as: > > myfunc(arg1, arg2, ...) > > and in its body I want to pass the stdarg (vararg) part of the stack such as: > > myfunc(arg1, arg2, ...) > { > > /* do stuff */ > > anotherfunction(argA, ...); > > /* do more stuff */ > > return; > } > > But because there is no parameter name for the vararg argument part (i.e.: > ...) I don't see how to pass that to anotherfunction() > > Can passing the vararg part be done? How? What you have to do is to pass the argument vector to the second function. You must have another version of "anotherfunction()" that takes a va_list as an argument instead of a variable number of arguments (like vprintf()). Your function would be similar to this: extern void vanotherfunction(va_list); void myfunc(arg1, arg2, ...) { va_list arglist; va_start(arglist, arg2); vanotherfunction(arglist); va_end(arglist); } Within vanotherfunction(), you manilulate arglist as if you had done a va_start() there, but the va_start is actually done in myfunc(). marcus hall -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com