Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!decvax!ima!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: Substitute for gets() Message-ID: <36247@think.UUCP> Date: 8 Feb 89 21:11:35 GMT References: <721@hscfvax.harvard.edu> Sender: news@think.UUCP Reply-To: barmar@kulla.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 14 In article <721@hscfvax.harvard.edu> xmjschm@hscfvax.harvard.edu (MJSchmelzer) writes: [Describes problems using scanf() in place of gets().] >Does this mean gets() is indispensable ? I don't think so. The simplest, safe replacement for gets() is fgets(). You'll have to specify stdin explicitly, and you'll have to strip off the trailing newline if you don't want it, but otherwise it's just what you want. Barry Margolin Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar