fcloseall(3)

✨ fcloseall(3) ✨

okay bestie, so this one lives in the Library Functions Manual πŸ’– β€” it's a libc era icon and we're gonna get into it.


🌸 NAME 🌸

fcloseall β€” close all open streams. every single one. no survivors. periodt πŸ’…


πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#define _GNU_SOURCE         /* See feature_test_macros(7) */
#include <stdio.h>

int fcloseall(void);

that #define _GNU_SOURCE line is not optional, bestie β€” you need it, and the comment is literally pointing you at feature_test_macros(7) if you wanna know why πŸ‘€


πŸ’œ DESCRIPTION πŸ’œ

So. fcloseall() closes all of the calling process's open streams. Like, every stream that process has open. all of them. it's giving spring cleaning 🧹✨

Buffered output for each stream gets written out before it's closed β€” same energy as fflush(3) β€” and buffered input just gets dropped on the floor. discarded. gone. bye πŸ™ˆ

and okay, here's the part that makes people gasp: the standard streams β€” stdin, stdout, and stderr β€” are also closed. yes, those ones. all three. πŸ’€


πŸ”₯ RETURN VALUE πŸ”₯

  • 0 β€” slay, everything closed successfully πŸŽ€
  • EOF β€” on error, that's what you get 😭

πŸ‘‘ ATTRIBUTES πŸ‘‘

For an explanation of the terms used in this section, see attributes(7). (yes, actually go look, it's right there ✨)

  • Interface: fcloseall()
  • Attribute: Thread safety
  • Value: MT-Unsafe race:streams

and the reason for that spicy value? fcloseall() does not lock the streams, so it is not thread-safe. no cap. if you're threading, this is a vibe check that you will fail 🚩


🌈 STANDARDS 🌈

GNU. πŸƒ (it's a GNU thing, okay, it's not in the standard C lineup β€” iykyk)


πŸ’– SEE ALSO πŸ’–

close(2), fclose(3), fflush(3), fopen(3), setbuf(3)


and that's the whole page, bestie! 🫢 this little ditty came to you courtesy of Linux man-pages 6.20, dated 2026-02-08, and yes the filename at the end is literally fcloseall(3) again because manpages love a dramatic repetition. go close some streams. not your stdout tho. maybe. your call. πŸ’…βœ¨

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms