Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!decvax!minow From: minow@decvax.UUCP Newsgroups: comp.lang.c Subject: Re: Help needed with and strings -- bad suggestion Message-ID: <33@decvax.UUCP> Date: Sun, 29-Mar-87 20:31:11 EST Article-I.D.: decvax.33 Posted: Sun Mar 29 20:31:11 1987 Date-Received: Tue, 31-Mar-87 01:52:49 EST References: <5902@brl-adm.ARPA> <725@instable.UUCP> Reply-To: minow@decvax.UUCP (Martin Minow) Distribution: world Organization: Digital Eq. Corp. - Merrimack NH. Lines: 17 In article <725@instable.UUCP> amos%nsta@nsc.com (Amos Shapir) comments on the return value for fgets() -- noting that fgets() returns a pointer to the start of the buffer: >This is done so you can do things like strcmp("END", fgets(...)) This is not a good idea -- if you try this at the end of the file (or if an error occurs), strcmp() may crash when it tries to derefence the NULL return. It is seldom a good idea to try to save a microsecond (or a few bytes of memory) when the alternative is a latent bug just waiting to happen. Martin Minow decvax!minow