Next: fdopen, Previous: fclose, Up: Stdio

### 4.5 `fcloseall`—close all files

Synopsis

         #include <stdio.h>
         int fcloseall(void);
         int _fcloseall_r (struct _reent *ptr);

Description
`fcloseall` closes all files in the current reentrancy struct's domain. The function `_fcloseall_r` is the same function, except the reentrancy struct is passed in as the ptr argument.

This function is not recommended as it closes all streams, including the std streams.

Returns
`fclose` returns `0` if all closes are successful. Otherwise, EOF is returned.

Portability
`fcloseall` is a glibc extension.

Required OS subroutines: `close`, `fstat`, `isatty`, `lseek`, `read`, `sbrk`, `write`.