Xref: utzoo comp.lang.c:31663 alt.lang.cfutures:44 Path: utzoo!utgpu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.lang.c,alt.lang.cfutures Subject: STDIO (Re: TRUE and FALSE) Message-ID: <38Q5QG2@xds13.ferranti.com> Date: 7 Sep 90 01:36:30 GMT References: <17632@haddock.ima.isc.com> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 45 In article <17632@haddock.ima.isc.com> karl@kelp.ima.isc.com (Karl Heuer) writes: > Fine; functions that have that property can be declared with a type other than > "bool". Functions that don't have any useful value to return on success can > and should return TRUE. (fgets() was another mistake.) Fgets() has a useful value to return: the number of characters read. A 0 length read from fgets should be an EOF (think about it). For that matter, the whole stdio suite is fubar. But, it's a standard. Perhaps a new library could be designed in alt.lang.cfutures FILE *openf(name, mode); char *name; int mode; /* From fcntl.h */ int readf(fp, buf, len); FILE *fp; char *buf; int len; int readlnf(fp, buf, len); FILE *fp; char *buf; int len; int parsef(fp, fmt, args...) FILE *fp; char *fmt; int readln(buf, len); char *buf; int len; int formatf(fp, fmt, args...); FILE *fp; char *fmt; int formats(buf, len, fmt, args...); char *buf; int len; char *fmt; Fp, when present, always comes first. Buffers are always associated with a length. Consistent rules for the syntax would make things a lot easier to remember. -- Peter da Silva. `-_-' +1 713 274 5180. 'U` peter@ferranti.com