home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- From: nikki@trmphrst.demon.co.uk (Nikki Locke)
- Path: sparky!uunet!pipex!demon!trmphrst.demon.co.uk!nikki
- Subject: Re: varargs
- Reply-To: nikki@trmphrst.demon.co.uk
- References: <1993Jan10.193617.5871@news.acns.nwu.edu>
- Distribution: world
- X-Mailer: cppnews $Revision: 1.30 $
- Organization: Trumphurst Ltd.
- Lines: 29
- Date: Mon, 11 Jan 1993 19:52:12 +0000
- Message-ID: <726807132snx@trmphrst.demon.co.uk>
- Sender: usenet@demon.co.uk
-
- In article <1993Jan10.193617.5871@news.acns.nwu.edu> ecm@casbah.acns.nwu.edu (Edward Malthouse) writes:
- > I am trying to write a function error which will will be declared as follows:
- > error(va_list)
- >
- > The usage will be
- > error(char *format, arg_list)
-
- Do you have some kind of problem with stdarg.h ? This is the standard
- method of doing variable argument lists, not the old varargs stuff.
-
- #include <stdarg.h>
-
- error(char *format, ...)
- {
- va_list args;
-
- va_start(args, format);
- vfprintf(stderr, format, args);
- va_end(args);
- cleanup();
- exit(1);
- }
-
- I expect that, even with the old varargs stuff, you need to call vfprintf,
- not fprintf. I am rather suspicious of your function declaration, also.
-
- --
- Nikki Locke,Trumphurst Ltd.(PC and Unix consultancy) nikki@trmphrst.demon.co.uk
- trmphrst.demon.co.uk is NOT affiliated with ANY other sites at demon.co.uk.
-