home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16609 < prev    next >
Encoding:
Text File  |  1992-11-16  |  1.5 KB  |  44 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!portal!dfuller
  3. From: dfuller@portal.hq.videocart.com (Dave Fuller)
  4. Subject: Re: Multiple Parameter Passing (unspecified number)
  5. Message-ID: <BxtrFG.Fq4@portal.hq.videocart.com>
  6. Organization: VideOcart Inc.
  7. X-Newsreader: Tin 1.1 PL3
  8. References: <92321.124834GNR100@psuvm.psu.edu>
  9. Date: Mon, 16 Nov 1992 19:57:16 GMT
  10. Lines: 32
  11.  
  12. GNR100@psuvm.psu.edu writes:
  13. :    Hi.
  14. :    I'm looking to write a function that accepts any number of paramerter.
  15. : There will be at least two, an int and a char[]. The rest will all be char[]'s.
  16. : I need to know how this is done.  The meathod would be similar to that of
  17. : printf(), so if anybody know how that works, please let me know.
  18. :                  Thanks,
  19. :                      Gordon Rogers
  20. :                      gnr100@psuvm.psu.edu
  21.  
  22.  
  23. Gordon,
  24.     Sort of depends. UNIX versions will use definitions from varargs.h and 
  25. non-UNIX platforms use stdarg.h (I believe these are the correct header files).
  26.  
  27. UNIX versions use va_dcl, va_start, va_end, va_arg, va_list, and va_alist
  28. non-UNIX versions use va_end, va_arg, va_list
  29.                       and va_start (with 1 extra parm)
  30. (not all of these are macros. va_alist, va_dcl, and va_list are variables)
  31.  
  32. I haven't used varargs in a while so this may not be complete.
  33.  
  34. Sorry this is not a full-blown answer, but if it doesn't get you headed
  35. in the right direction, write me. As i said, i will respond with full
  36. functional usage of the variable argument scheme.
  37.  
  38.  
  39. Dave Fuller
  40. dfuller@portal.hq.videocart.com
  41.  
  42.