Xref: news2.mv.net comp.os.msdos.djgpp:5883 From: Norbert Jay Newsgroups: comp.os.msdos.djgpp Subject: Beating fflush to death Date: Wed, 10 Jul 1996 14:43:14 -0700 Organization: PANIX Public Access Internet and Unix, NYC Lines: 15 Message-ID: <31E423F2.5386@panix.com> Reply-To: norbertj AT panix DOT com NNTP-Posting-Host: norbertj.dialup.access.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp My how to write C books says that SOMETIMES scanf leaves a newline character behind in the buffer. The book suggests fflush(stdin) which as we all know does not work. I use gets(dum) (char dum[1]) to clear the buffer after each scanf fpr this particular program. 1. Will this work on ALL versions of DOS? If so, why is something like it built into the lib? 2. The FAQ suggests using sync() but gives no hint how or why? 3. Browsing that great mail archive in delorie's home page confused me even more what with scanf("%*[^\n]\n") which I could not get to work. 4. Is the inconsistency between systems like DOS - UNIX or is it internal to each system