From: "John M. Aldrich" Newsgroups: comp.lang.c,comp.os.msdos.djgpp Subject: Re: '...' handling (with djgpp, although likely ubiquitous)... Date: Sun, 03 Aug 1997 15:22:44 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 47 Message-ID: <33E4A244.7B5A@cs.com> References: <33e5c2e0 DOT 51066140 AT news DOT bc1 DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp200.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Burton Radons/Lothloriel, Hollow Dreams wrote: > > Base function: > > char *rsprintf(const char *format, ...) > { > va_list args; > char *buffer; > /* and on and on... */ > } > > What would I have to do to... err... set 'args' to '...'? That half of the > reference manual was stolen several years ago, before I could get to it, so > fluid-depth arguments are still an absolute mystery to me. The va_args syntax was discussed in detail in the documentation for DJGPP v1.12, but mysteriously disappeared in the upgrade to v2.x. However, if you look at the vprintf() function in the docs, you will see the full syntax for passing variable arguments to the special functions provided for them. If you want to see how to use the arguments manually, you will need to get the library sources and examine src/libc/ansi/stdio/vprintf.c; it's a bit complicated to explain in a post and I don't fully understand it myself. :) So you don't go away empty-handed, here's the basic syntax: int myprintf( const char *format, ... ) { va_list args; int r; va_start( args, format ); r = vprintf( format, args ); va_end( args ); return r; } -- --------------------------------------------------------------------- | John M. Aldrich | "It may be better to be a live jackal| | aka Fighteer I | than a dead lion, but it is better | | mailto:fighteer AT cs DOT com | still to be a live lion." | | http://www.cs.com/fighteer | - Lazarus Long | ---------------------------------------------------------------------