fpurge(3bsd)

πŸ“¦
version 0.12.2 Β· 2 versions
  • 0.12.2 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.11.5 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ fpurge β€” flush a stream ✨

okay bestie, welcome to the fpurge page πŸ’… this is from the 3bsd manual section, local vibes only, and it's literally the stream-clearing baddie you didn't know you needed.


πŸŽ€ LIBRARY

utility functions from BSD systems, aka libbsd, and you link it with -lbsd. yes that's the whole thing. she's low maintenance fr fr 🫢


🌸 SYNOPSIS

#include <stdio.h>
(See libbsd(7) for include usage.)

int
fpurge(FILE *stream);
side note bestie: peep libbsd(7) for the whole include-usage situation, it's giving "read the fine print" πŸ™ˆ

πŸ¦‹ DESCRIPTION

so the function fpurge() erases any input or output buffered in the given stream. no cap, all of it, gone.

for output streams, this discards any unwritten output. bye bestie, never made it out the door πŸ’€

for input streams, this discards any input that was read from the underlying object but hasn't yet been obtained via getc(3). and yes, that includes any text that got pushed back via ungetc(3). she's thorough. she's iconic. periodt. πŸ‘‘


πŸ’– RETURN VALUES

  • upon successful completion, 0 is returned ✨
  • otherwise, EOF is returned, and the global variable errno is set to indicate the error 😭

πŸ”₯ ERRORS

  • [EBADF] β€” stream is not an open stream. like girl. she's not even open. what are we doing here πŸ™ˆ

🌈 SEE ALSO


πŸ‘‘ HISTORY

the fpurge() function first appeared in 4.4BSD-Lite. a legend from the jump, we love a historical queen πŸ’œ


and that's the whole page bestie, no notes πŸŽ€ this version is from the Debian crew and it's dated November 4, 2015 β€” mwah, go clear some buffers, you got this πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from