[comp.lang.c] Passing variable length argument list to functions

mps@hri.com (Mark Stockley) (07/27/90)

I want to create a routine called from C that receives a variable length
argument list (just like printf() for example). How does one do that in
C? In fact, if anyone could tell me how printf does it (or where I might
find the code on my Sparc), that would be good enough.

Thanks in advance.

------------------------------------------------------------------------------
Mark P. Stockley    |   INET: mps@hri.com    | But I don't like Spam!!!
Horizon Research    |  Voice: (617) 466-8361 | 
1432 Main St.,      |   		     | Is the alphabet in that order
Waltham MA. 02154   |    FAX: (617) 466-8323 | or is it because of that song?
------------------------------------------------------------------------------

brianh@hpcvia.CV.HP.COM (brian_helterline) (07/27/90)

>I want to create a routine called from C that receives a variable length
>argument list (just like printf() for example). How does one do that in
>C? In fact, if anyone could tell me how printf does it (or where I might
>find the code on my Sparc), that would be good enough.

	Can you say varargs? :)  You probably won't find the source for
	printf, but take a look at vprintf and varargs.h.  These should
	explain how to handle varaible length arguments.
>
>Thanks in advance.

	Your welcome in retrospect.


>------------------------------------------------------------------------------
>Mark P. Stockley    |   INET: mps@hri.com    | But I don't like Spam!!!
>Horizon Research    |  Voice: (617) 466-8361 | 
>1432 Main St.,      |   		     | Is the alphabet in that order
>Waltham MA. 02154   |    FAX: (617) 466-8323 | or is it because of that song?
>------------------------------------------------------------------------------
>----------


-------------------------------------------------------------------------------
Brian Helterline                                        brianh@hpcvia.cv.HP.COM
Hewlett Packard                                         ..!hp-pcd!hpcvia!brianh
Corvallis, OR  97330           				Warning: error C390 - 
							No saying found.
							core dump.