Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!oberon!nunki.usc.edu!jeenglis From: jeenglis@nunki.usc.edu (Joe English) Newsgroups: comp.lang.c Subject: Re: varargs and scanf Keywords: vfprintf, ANSI C,... Message-ID: <2607@nunki.usc.edu> Date: 6 Feb 89 05:47:25 GMT References: <1494@zen.UUCP> <9553@smoke.BRL.MIL> Reply-To: jeenglis@nunki.usc.edu (Joe English) Organization: University of Southern California, Los Angeles, CA Lines: 39 gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >In article <1494@zen.UUCP> vic@zen.UUCP (Victor Gavin) writes: [...] >>My other problem is that there isn't a varargs version of scanf(). Is there >>one in ANSI C or is it something that only I would find useful? > >No, v*scanf() are not in the proposed ANSI C Standard. In fact there >was considerable sentiment for removing the normal *scanf() functions. > >I'm not sure how useful v*scanf() would be; I've never felt the need >for it, though. Are v?printf also not in the standard? I've used vsprintf a couple of times (on the apparently mistaken assumption that it would be portable across compilers). It's proven useful when I wanted to use printf-style output with a non-file output object. (For example, in a window package for IBM PCs). Is there a way to do the following in ANSI-conformant C: void winprintf(struct WINDOW *w,char *fmt,...) { va_list ap; char buffer[BIGNUMBER]; va_start(ap,fmt); vsprintf(buffer,fmt,ap); va_end(ap); winputstring(w,buffer); } --Joe English jeenglis@nunki.usc.edu