TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Bill Patterson
from: George White
date: 1995-08-27 11:03:00
subject: Re: gcc2

Hi Bill,

You wrote to Thomas Seeling:

BP> TS>  TS>> fflush() is only defined for output streams.
BP> TS>  BP> I meant fflush(stdin)
BP> TS> You meant wrong, then.

BP>According to my instructor at the college and SAM's
BP>"Programming in ANSI C" page 457, I meant right.

Thomas is right and both your instructor and the book are wrong.

I don't have the ANSI spec but I've just checked my compiler manuals
(Microsoft, Borland, IBM CSET and Watcom) and Borland specify it as
working on Output streams only, Watcom and IBM as working on output
streams and undoing the effect of any "ungetc" operation on input
streams (but then virtually any operation on the stream other than a
read will undo the "ungetc" operation) and only Microsoft as flushing
input streams.

It's yet another case of people assuming the the way the least ANSI
compilant compiler (Microsoft's) operates is the correct way :-(

George

 * SLMR 2.1a * Users are always right ... until they are out of earshot.

--- Maximus/2 3.00
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 440/4 141/209 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.