[comp.lang.c++] Passing variable #arguments through method

jxf@procyon.cis.ksu.edu (Jerry Frain) (08/03/90)

Please pardon my ignorance, but is there a simple way to do the following:

class foo {
public:
	print(char *fmt, ...)	{ fprintf(a_file, fmt, ...); }
}

Where the (...) in the fprintf would be the same arguments as passes
to the foo::print() method?

I have tried a number of things, but I can't seem to find a way to get it
to work, other than writing a long (or many) method declarations.

Thanks in advance,

  --Jerry

--
Jerry Frain -- Perpetual Student		Kansas State University
                                 	Department of Computing & Info Sciences
Internet : jxf@ksuvax1.cis.ksu.edu                Manhattan, Kansas
UUCP     : ...!{rutgers,textbell}!ksuvax1!jxf

rfg@NCD.COM (Ron Guilmette) (08/05/90)

In article <1990Aug3.165607.2292@maverick.ksu.ksu.edu> jxf@procyon.cis.ksu.edu (Jerry Frain) writes:
>Please pardon my ignorance, but is there a simple way to do the following:
>
>class foo {
>public:
>	print(char *fmt, ...)	{ fprintf(a_file, fmt, ...); }
>}
>
>Where the (...) in the fprintf would be the same arguments as passes
>to the foo::print() method?

You should get a copy of the ANSI C standard and look at the descriptions
of the <stdarg.h> include file (and what it does for you) and also at
the description of the vfprintf() function.

i
n
e
w
s

b
i
t
e
s

-- 
// Ron Guilmette
// C++ Entomologist
// Internet: rfg@ncd.com      uucp: ...uunet!lupine!rfg
// Motto:  If it sticks, force it.  If it breaks, it needed replacing anyway.