Path: utzoo!attcan!uunet!ingr! From: rob@b15.INGR.COM (Rob Lemley) Newsgroups: comp.lang.c Subject: Re: What's so bad about scanf anyway??? Message-ID: <1793@b15.INGR.COM> Date: 12 Nov 90 23:49:48 GMT References: <16582@netcom.UUCP> <1990Nov12.050450.7194@Solbourne.COM> Organization: Intergraph Huntsville Lines: 22 th: b15!rob In <1990Nov12.050450.7194@Solbourne.COM> imp@marvin.Solbourne.COM (Warner Losh) writes: >True. However, I'd use fgets(). See below. . . . >gets() is a bad function to use when you don't have total control over >the input (like a user typing at a program). Since it can't check to >see if the input line is too large for the buffer, "bad things" can >happen as a result. Another bad: Both gets() and fgets() (SysV R3) will blindly read in NULL chars (ascii zero's). Since gets() and fgets() return no info about the number of chars read (unless you use ftell() maybe?), you might throw away a whole or partial line of input (and never know about it!). Rob -- Rob Lemley System Consultant, Scanning Software, Intergraph, Huntsville, AL rcl@b15.ingr.com OR ...!uunet!ingr!b15!rob 205-730-1546