Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: fgets() returns NULL at EOF?? Message-ID: <86900049@haddock> Date: Tue, 9-Sep-86 13:20:00 EDT Article-I.D.: haddock.86900049 Posted: Tue Sep 9 13:20:00 1986 Date-Received: Tue, 9-Sep-86 21:17:54 EDT References: <1094@bu-cs.bu-cs.BU.EDU> Lines: 19 Nf-ID: #R:bu-cs.bu-cs.BU.EDU:1094:haddock:86900049:000:968 Nf-From: haddock!karl Sep 9 13:20:00 1986 Bader@b.psy.cmu.edu writes: >[concerning the return value of gets()/fgets()] >Neither of your suggestions (# of characters, EOF or 0) makes any more sense >to me than the current behavior, which seems perfectly reasonable. If >nothing better is being offered, why waste time arguing about it? In the current behavior, the value on successful return is the buffer arg -- a useless value already available to the user. The character count is not available except by calling strlen(), which is somewhat redundant since the library function already has the value (or enough information to construct it in constant time). There is a similar duplication of effort in strcpy() followed by strcat(), for which reason I think strcpy() should've returned the END of the string (pointer to the '\0') instead of the beginning. I need that value more often than I need a copy of the first argument. Karl W. Z. Heuer (ima!haddock!karl; karl@haddock.isc.com), The Walking Lint