File descriptors and streams and copying thereof.

Karl Heuer karl at haddock.ima.isc.com
Wed Apr 26 03:41:53 AEST 1989


In article <1522 at cfa.cfa.harvard.EDU> gwc at root.co.uk (Geoff Clare) writes:
>All that is necessary is a fflush(stdin) before any change of
>the file associated with fileno(stdin).  This will result in loss
>of data already read into the buffer, but the same is true of
>Lloyd's proposed method, due to the freopen().

Since we're talking about portable mechanisms, fflush() on an input stream
should also be avoided.  It doesn't work in all existing UNIXes, and it's
an undefined operation according to the pANS.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list