tcflush(3)
π tcflush β bestie edition π
okay so this one is a page from the Library Functions Manual, and it's called tcflush(3). yes the (3) is part of the name, that's just how library-call girlies do it π it lives in the Standard C library, a.k.a. libc, a.k.a. -lc when you're linking. iconic. periodt.
β¨ NAME β¨
tcflush β discard pending data π
like. it throws away the leftovers. the un-sent, the un-read. ghosting your terminal data fr fr.
π«Ά LIBRARY π«Ά
Standard C library (libc, -lc)
πΈ SYNOPSIS πΈ
#include <termios.h>
int tcflush(int fd, int queue_selector);
two args, one int for the file descriptor, one int for the queue selector. simple. clean. lowkey elegant.
π DESCRIPTION π
so tcflush() discards data. and which data it discards depends entirely on queue_selector, okay bestie, pay attention:
- it'll toss data written to the object that
fdrefers to but that hasn't actually been transmitted yet, or - it'll toss data that's been received but hasn't been read yet.
and the queue_selector values are:
TCIFLUSHβ flushes data received but not read. bye bestie πTCOFLUSHβ flushes data written but not transmitted. never made it out the door πTCIOFLUSHβ flushes BOTH of them: data received but not read, AND data written but not transmitted. equal opportunity deletion. slay.
β RETURN VALUE β
0β on success π everything's fine, nothing to worry about, go off-1β on failure, and it setserrnoto indicate the error π check yourerrno, that's the whole point
π¦ ATTRIBUTES π¦
for an explanation of the terms used in this section, go peek at attributes(7) β it's giving homework but it's worth it.
- interface:
tcflush()- attribute: Thread safety
- value: MT-Safe β¨ (yes bestie, you can call it from multiple threads, it's safe, we love that for us)
π STANDARDS π
POSIX.1-2008. that's the one. π
π HISTORY π
POSIX.1-2001. so it's been around a while β vintage, but make it fashion π
π SEE ALSO π
just a lil reminder bestie: flushing means the data is gone. discarded. not queued, not saved, not buffered somewhere cute. if you weren't done with it, that's on you π
and that's the whole page!! this one came from Linux man-pages 6.20, dated 2026-07-02 β shoutout to the man-pages girlies for keeping the docs fed π«Ά mwah, go flush responsibly πβ¨
π¦ 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: GPL-2.0-or-later
- Copyright 2006-2015, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms