| 1 |
'\" t |
| 2 |
.\" Copyright 2006, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH fcloseall 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
fcloseall \- close all open streams |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
| 16 |
.B #include <stdio.h> |
| 17 |
.P |
| 18 |
.B int fcloseall(void); |
| 19 |
.fi |
| 20 |
.SH DESCRIPTION |
| 21 |
The |
| 22 |
.BR fcloseall () |
| 23 |
function closes all of the calling process's open streams. |
| 24 |
Buffered output for each stream is written before it is closed |
| 25 |
(as for |
| 26 |
.BR fflush (3)); |
| 27 |
buffered input is discarded. |
| 28 |
.P |
| 29 |
The standard streams, |
| 30 |
.IR stdin , |
| 31 |
.IR stdout , |
| 32 |
and |
| 33 |
.I stderr |
| 34 |
are also closed. |
| 35 |
.SH RETURN VALUE |
| 36 |
This function returns 0 if all files were successfully closed; |
| 37 |
on error, |
| 38 |
.B EOF |
| 39 |
is returned. |
| 40 |
.SH ATTRIBUTES |
| 41 |
For an explanation of the terms used in this section, see |
| 42 |
.BR attributes (7). |
| 43 |
.TS |
| 44 |
allbox; |
| 45 |
lbx lb lb |
| 46 |
l l l. |
| 47 |
Interface Attribute Value |
| 48 |
T{ |
| 49 |
.na |
| 50 |
.nh |
| 51 |
.BR fcloseall () |
| 52 |
T} Thread safety MT-Unsafe race:streams |
| 53 |
.TE |
| 54 |
.P |
| 55 |
The |
| 56 |
.BR fcloseall () |
| 57 |
function does not lock the streams, so it is not thread-safe. |
| 58 |
.SH STANDARDS |
| 59 |
GNU. |
| 60 |
.SH SEE ALSO |
| 61 |
.BR close (2), |
| 62 |
.BR fclose (3), |
| 63 |
.BR fflush (3), |
| 64 |
.BR fopen (3), |
| 65 |
.BR setbuf (3) |