The man page of exit
says,
- All open
stdio
streams are flushed and closed. Files created bytmpfile
are removed. - Parameters of
exit
i.eEXIT_SUCCESS
andEXIT_FAILURE
are slightly more portable (to non-UNIX environments) than the use of 0 and some nonzero value like 1 or -1. In particular, VMS uses a different convention.
The man page of fcloseall
says,
- The standard streams,
stdin
,stdout
, andstderr
are also closed. - The
fcloseall
function does not lock the streams, so it is not thread-safe.
Many online tutorials say that deallocating "all" resources of a given type is a programming error. They should be deallocated individually by the code that owns them or not at all.
So is it good to use exit
instead of fcloseall
?