Date: Tue, 16 Apr 1996 16:22:17 +0800 (GMT+0800) From: Old System Diagnostic To: j DOT aldrich6 AT genie DOT com cc: djgpp AT delorie DOT com Subject: Re: End of file keyboard symbo In-Reply-To: <199604160421.AA018178512@relay1.geis.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 16 Apr 1996 j DOT aldrich6 AT genie DOT com wrote: > The idea solution to all of this is to simply use gets() and sscanf(). > If gets() sees an EOF, it simply returns NULL, and no matter what > else goes on, it gets an entire input line, including the c/r. So if > the user wants to end input with an EOF, just check the return value > of gets(). > > The other really nice thing about using gets() is that it doesn't force > the user to type anything before pressing Enter. Just examine the > resulting buffer. If you really expect input, just prompt the user again. Uh, before you get carried away with your praise of gets (), remember that gets () was what let the Internet Worm work. It doesn't check for buffer overflow. I suggest (as do zillions of other people) fgets().