Redirection, Xterms, and Flushing STDIN

Jonathan I. Kamens jik at athena.mit.edu
Thu Mar 7 08:58:03 AEST 1991


In article <JC.91Mar5053752 at raven.bu.edu>, jc at raven.bu.edu (James Cameron) writes:
|>   printf("\n\nHit <enter> to close window: ");
|>   fflush(stdin);
|>   fflush(fp);
|>   ch = getchar();

>From the man page fflush(3):

     Fflush causes any buffered data for the named output stream
     to be written to that file.  The stream remains open.

     ...

     These routines return EOF if stream is not associated with
     an output file, or if buffered data cannot be transferred to
     that file.

Stdin is not an output file.  Why are you trying to flush stdin?  Perhaps you
meant to be flushing stdout?

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list