open_rw(3)

πŸ“¦
version 0.34 Β· 3 versions
, in alpine 3.24, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu resolute, ubuntu stonking

open_rw πŸ’–βœ¨

okay bestie, so this one lives in the Library Functions Manual (section 3, the "we do syscalls but cute" section) and it's literally called open_rw β€” the rw stands for read and write, because why choose πŸŽ€


✨ NAME ✨

open_rw β€” open a file for reading and writing 🫢


🌸 SYNTAX 🌸

#include <libowfat/open.h>

int open_rw(const char *filename);

πŸ’… DESCRIPTION πŸ’…

so open_rw opens the file filename for reading AND writing use, and hands you back the file handle. two moods, one function, we love a multitasker πŸ’–

if the file doesn't exist yet? no worries bestie, it gets created for you with mode 0644 ✨

and if something goes wrong β€” opening it, creating it, any of it β€” open_rw returns -1 and sets errno accordingly, so you can go check what the drama was 😭

lowkey important: -1 means something went sideways, and errno is where the gossip lives. always peek at errno, fr fr.

πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, go say hi:


and that's the whole page, no cap 🌈 go open some files, you got this, mwah πŸ’œ

signing off from the Library Functions Manual, page open_rw(3) β€” that's the source and the name, bestie, that's the whole footer πŸŽ€πŸ¦‹