
...
The behavior of a program is undefined when it uses the value of a pointer to a FILE
object after the associated file is closed (see undefined behavior 148153.) Programs that close the standard streams (especially stdout
but also stderr
and stdin
) must be careful not to use the stream objects in subsequent function calls, particularly those that implicitly operate on such objects (such as printf()
, perror()
, and getc()
).
...