Skip to content
Advertisement

Tag: fclose

Close file in C

Under Linux I use this code to redirect stdout and stderr on a file, as shown in the code the file is opened using fopen(f) and is it closed using close(fd). My question is whether the close(fd) statement closes all file descriptors, or is it necessary to use fclose(f) as well ? Answer The rule is to close the outermost

Proper error handling for fclose impossible (according to manpage)?

So I’m studying fclose manpage for quite I while and my conclusion is that if fclose is interrupted by some signal, according to the manpage there is no way to recover…? Am I missing some point? Usually, with unbuffered POSIX functions (open, close, write, etc…) there is ALWAYS a way to recover from signal interruption (EINTR) by restarting the call;

Advertisement