Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!tuvie!vmars!hp From: hp@vmars.tuwien.ac.at (Peter Holzer) Newsgroups: comp.os.minix Subject: Re: vfprintf problem Message-ID: <2307@tuvie.UUCP> Date: 9 Feb 91 19:24:08 GMT References: <1991Feb5.180022.01726@ptavv.ka.sub.org> Sender: news@tuvie.UUCP Lines: 46 ralf@ptavv.ka.sub.org (Ralf Wenk) writes: >#include >#include >FILE *log; >char line[LINESIZE+1]; >void lprintf ( ctl, argp ) >char *ctl; >va_list argp; >{ > vfprintf( log, ctl, argp ); >} /* lprintf */ >Down in the source lprintf() is called like this: >lprintf("batch from %s", line ); >Is is also interesting, that changing the call to vfprintf( log, ctl, &argp ) >will fix it. Do I misunderstand how to use stdarg.h or is this an MINIX ST >problem ? >I just use it the way vsprintf() uses it. You do misunderstand how to use stdarg.h. Your function should read: void lprintf (ctl) char *ctl; { va_list argp; va_start (argp, ctl); vfprintf( log, ctl, argp ); va_end (argp); } /* lprintf */ Actually, the function header should be void lprintf (char * ctl, ...), but as Minix-cc isn't ANSI yet, you can't do this. -- | _ | Peter J. Holzer | Think of it | | |_|_) | Technical University Vienna | as evolution | | | | | Dept. for Real-Time Systems | in action! | | __/ | hp@vmars.tuwien.ac.at | Tony Rand |