Subj : Re: varargs(ish) To : comp.programming From : pemo Date : Sun Aug 21 2005 09:57 am Yes, I agree that the switch and first param are irrelevant. Thanks for the vprintf ref, in my 'out' function, I can now use vprintf to output to stdout - great. However, how can I then go on to use fprintf to output to a file? It would seem that vsprintf is the thing to use??? pemo "Alex Fraser" wrote in message news:0MmdnRKoNNHsJZreRVnytA@eclipse.net.uk... > "pemo" wrote in message > news:kBJNe.92863$G8.76586@text.news.blueyonder.co.uk... >> I'd like to write a C function that can accept variable args *and* a >> fixed arg that tells the function whether to output to stdout and >> optionally, a file. > > Your emphasis doesn't make sense. You would have the same problem > regardless, which is equivalent to: > > void out(const char *fmt, ...) { > /* somehow call printf() with the correct arguments */ > } > > The solution in the above case is to use vprintf() instead. > > Alex > > .