After a call like freopen(file_name, open_mode, stderr), do I need to call fclose(stderr) before the process ends or it is done automatically ? thanks in advance and sorry for my English
It is not necessary to close an open stream as all open streams are closed at program termination but it is good practice to have a fclose
for every fopen
call. In the case of stderr
here, this stream is already open at startup (you didn't have to call fopen
) and so I see no reason to explicitly close it even if some freopen
calls were issued.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With