Write both in std output and in a file ?

Alex Martelli aleax at aleax.it
Fri Jan 18 09:07:46 EST 2002


"Paul Jackson" <pj at sgi.com> wrote in message
news:a27pgs$4im7j$1 at fido.engr.sgi.com...
> Alex replied to Chris:
> |> > Actually C does the auto-close also (at least on all platforms I've
> |> > worked on).
> |>
> |> I recall reasonably-early C compilers for DOS that didn't auto-close.
>
> I really doubt that C is doing any auto close.  On the other
> hand, I really doubt that I've caught Alex Martelli in such a
> misstatement, so I must be confused <grin>.

I think Donn has clarified that, but, just to reiterate: an
operating system may or may not (certainly _should_) close
files on process exit if it does support such notions as
processes and files.  But that is NOT the same as performing
a C-level fclose on each FILE that a C program has opened
(for writing), as I believe the ISO C standard specifies
should happen when a program terminates by calling exit() or
by returning from main() -- buffers may be unflushed or
partially flushed, etc.  There are indeed, even in standard
complying C, situations that may terminate the program's
execution _without_ such cleanup activities (e.g., an
uncaught signal -- or popular extensions such as _exit).


Alex






More information about the Python-list mailing list