Article View: comp.std.c
Article #2069Re: is fflush(stdin) conformant???
From: Murray Nesbitt
Date: Thu, 05 Nov 1992 11:02
Date: Thu, 05 Nov 1992 11:02
19 lines
1213 bytes
1213 bytes
mgk@sql.sybase.com (Michael Keirnan aka Joe Cool) writes: >I am not actually comtemplating using this construct. A coworker is >enrolled in a course where the instructor has advised flushing stdin >(yes, stdin) in conjunction with using scanf() to "flush the unwanted >newline." This seemed rather odd to me, but hey, what do I know? >So what sayeth the gospel on the subject? fflush()ing an input stream has no defined effect in ANSI C - it is intended for output streams or update streams (in which the most recent I/O operation was not input) only. It may "flush the unwanted newline" on some particular systems, but if the instructor claims it is a universal way of doing this in C, she's wrong. -- Murray
Technical Details
Message-ID:
<MJN.92Nov5030241@pseudo.uucp>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!utzoo!telly!druid!pseudo!mjnReferences:
<MGK.92Nov2131855@cedar.sql.sybase.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!utzoo!telly!druid!pseudo!mjn From: mjn@pseudo.uucp (Murray Nesbitt) Subject: Re: is fflush(stdin) conformant??? Organization: Private system in Toronto, ON Date: Thu, 5 Nov 1992 11:02:41 GMT Message-ID: <MJN.92Nov5030241@pseudo.uucp> In-Reply-To: mgk@sql.sybase.com's message of 2 Nov 92 21:18:55 GMT References: <MGK.92Nov2131855@cedar.sql.sybase.com> Sender: mjn@pseudo.uucp (Murray Nesbitt) Lines: 19