c - Should "freopen'ed" stdout be closed? -
in c or c++ program can use freopen redirect output (i.e. stdout file descriptor) file (or discard reopening file descriptor /dev/null or sink).
the question is: if so, should take care of closing file descriptor explicitly before program ends execution? why? on platforms? happens in general , in specific case if don't close file descriptor?
should take care of closing file descriptor explicitly before program ends execution?
from
freopen(3)man page:the
freopen()function opens file name string pointed filename , associates stream pointed stream it. original stream (if exists) closed.so no, don't have close original
file *. should close 1freopencall, though. btw - thesefile *variables, not file descriptors.why?
because documentation says don't have to.
on platforms?
any correctly implement
freopen(3)defined c standard.what happens in general , in specific case if don't close file descriptor?
the operating system cleans resources used program when program exits.
Comments
Post a Comment