Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!sri-unix!quintus!ok
From: ok@quintus.UUCP (Richard A. O'Keefe)
Newsgroups: comp.lang.c
Subject: closing stdout
Message-ID: <437@cresswell.quintus.UUCP>
Date: Sat, 5-Dec-87 23:09:24 EST
Article-I.D.: cresswel.437
Posted: Sat Dec  5 23:09:24 1987
Date-Received: Thu, 10-Dec-87 22:28:50 EST
Organization: Quintus Computer Systems, Mountain View, CA
Lines: 14
Keywords: stdio error detection

In one of my messages, I said that I had learned that I ought to
fclose(stdout) or fflush(stdout) in order to check that the output
had in fact gone out as intended.

Roberto Shironoshita at the University of Pennsylvania
just sent me e-mail pointing out that fclose() generally tries to free()
things, and this might cause trouble for stdout.  As far as I know,
fclose() is smart enough to tell whether the stream you are closing was
one of its initial pool of statically allocated ones.  fclose(stdout)
and fclose(stdin) certainly work perfectly well on a SUN.
freopen(stdin,...) and freopen(stdout,...) are DEFINITELY supposed to work.

He's right nevertheless:  it's probably not a good idea to try to close
any of the preconnected streams, and fflush(stdout) is all the check I need.