Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!ico!ism780c!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: File descriptors and streams and copying thereof. Keywords: fopen, stream, FILE Message-ID: <12782@haddock.ima.isc.com> Date: 25 Apr 89 17:41:53 GMT References: <1743@leah.Albany.Edu> <8450@xanth.cs.odu.edu> <1522@cfa.cfa.harvard.EDU> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 11 In article <1522@cfa.cfa.harvard.EDU> gwc@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@haddock.isc.com), The Walking Lint