According to this documentation, the temporary file created by tmpfile() is closed and deleted when the program exits normally. So far, I have not found any details regarding the use of fclose() on such file.
CodePudding user response:
Is it safe to use
fclose()on a temporary file created bytmpfile()?
Yes, OK to close.
The
tmpfilefunction creates a temporary binary file that is different from any other existing file and that will automatically be removed when it is closed or at program termination. If the program terminates abnormally, whether an open temporary file is removed is implementation-defined.
C17dr § 7.21.4.3 2
