delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/17/18:30:26

From: "John M. Aldrich" <fighteer AT cs DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: trouble with ellipes in functions
Date: Mon, 17 Aug 1998 18:26:59 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 22
Message-ID: <35D8AE33.1B71DA73@cs.net>
References: <35D5B0EE DOT 1E94 AT osu DOT edu>
NNTP-Posting-Host: ppp232.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

brentlinger DOT 4 AT osu DOT edu wrote:
> 
> I'm writing a function that needs a varible numder of inputs ie (,...)
> but I can,t seem to get it to work. Could someone post the sources to
> printf() or a similar example?

What you are looking for is the variable arguments functionality of ANSI
C.  These are implemented through a type, va_list, and the macros
va_start(), va_arg(), and va_end(), all defined in <stdarg.h>.  They are
not directly documented in the DJGPP libc docs.  However, you can find
an example of use in the library sources for vprintf(), vsprintf(),
vfprintf(), etc., also declared in <stdarg.h>.

The comp.lang.c FAQ (http://www.eskimo.com/~scs/C-faq/top.html)
discusses variable argument lists in chapter 15.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |     mailto:fighteer AT cs DOT net     |
| Plan:  To find ANYONE willing to |   http://www.cs.net/fighteer/  |
| play Descent 2 on DWANGO!        |       ICQ UIN#:  7406319       |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019