open_trunc(3)
πΈ NAME πΈ
bestie. open_trunc β open a file for writing. that's it. that's the girl. π
(this lil page lives in the Library Functions Manual, iykyk)
β¨ SYNTAX β¨
okay so first you gotta pull her in, like this:
#include <libowfat/open.h>
and then the signature itself, which is literally:
int open_trunc(const char *filename);
no cap, that's the whole vibe. π
π¦ DESCRIPTION π¦
so open_trunc opens the file filename for write-only use and hands you back the file handle. main character behavior, honestly.
here's the tea though, and it's important π
- if the file already exists, it gets truncated to zero bytes length. like, gone. wiped. bye. π
- if it does not exist, it gets created with mode
0644. new file, fresh start, slay. β¨ - and if there was an error opening or creating the file,
open_truncreturns-1and setserrnoaccordingly. not the glow-up we wanted but at least she tells you. π
π«Ά SEE ALSO π«Ά
go read these next, they're all part of the friend group:
open(2)open_append(3)open_excl(3)open_read(3)open_rw(3)open_write(3)openreadclose(3)readclose(3)readclose_append(3)
and that's the whole page, bestie!! this one came from the Library Functions Manual, and the lil footer at the bottom is literally just open_trunc(3) again, saying her own name one more time on the way out. iconic. π
πΈ no version or date stamp on this one, just pure open_trunc(3) energy. mwah. π¦π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms