🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2066

Re: is fflush(stdin) conformant???

#2066
From: Soenke Behrens
Date: Thu, 05 Nov 1992 07:10
26 lines
1810 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?

It says: The behaviour of fflush() is only defined for output (i.e.
write) streams.
So, any given implementation might work the way your friend uses it,
not work that way, or play the Yankee Doodle :)

>The reason I'm interested is that someone teaching a course is
>advocating this usage, and IFF they are incorrect I'd like to set the
>record straight before legions of C-programmers adopt this method.

Good idea indeed :) This is somewhat in the same league (sp?) as assuming
the size of any given type, although less annoying :)

Soenke
-- 
===========================================================================
More than silver, more than gold, I need   !    behrenss@informatik.
electricity. I need it for my dreams.      !    tu-muenchen.de
(RACTER)                                   !  FIDO: 2:246/13 Soenke Behrens
Technical Details
Message-ID: <behrenss.720947417@hphalle6>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!agate!doc.ic.ac.uk!uknet!mcsun!Germany.EU.net!rrz.uni-koeln.de!unidui!math.fu-berlin.de!informatik.tu-muenchen.de!hphalle6!behrenss
References: <MGK.92Nov2131855@cedar.sql.sybase.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!agate!doc.ic.ac.uk!uknet!mcsun!Germany.EU.net!rrz.uni-koeln.de!unidui!math.fu-berlin.de!informatik.tu-muenchen.de!hphalle6!behrenss
From: behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens)
Newsgroups: comp.std.c
Subject: Re: is fflush(stdin) conformant???
Message-ID: <behrenss.720947417@hphalle6>
Date: 5 Nov 92 07:10:17 GMT
References: <MGK.92Nov2131855@cedar.sql.sybase.com>
Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
Distribution: comp
Organization: Technische Universitaet Muenchen, Germany
Lines: 26