Close all open stream files
#include <stdio.h> int fcloseall( void );
libc
The fcloseall() function closes all open streams, except stdin, stdout and stderr. This includes streams created (and not yet closed) by fdopen(), fopen() and freopen().
0
If an error occurs, errno is set.
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
printf( "The number of files closed is %d\n", fcloseall() );
return EXIT_SUCCESS;
}
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
fclose(), fdopen(), fopen(), freopen()