io_createfile(3)

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

✨ io_createfile(3) ✨

okay bestie, gather round πŸ’– this is io_createfile, straight out of the Library Functions Manual, and it does exactly one (1) thing and does it iconically: it makes you a file. let's get into it 🫢


🌸 NAME 🌸

io_createfile β€” create a file ✨


πŸŽ€ SYNTAX πŸŽ€

#include <libowfat/io.h>

int io_createfile(int64* d,const char* filename);

no cap, that's the whole vibe check right there πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie πŸ“ io_createfile sets d to the number of a brand new descriptor that's writing to the disk file named filename, and then it returns 1. slay. πŸŽ‰

  • if filename already existed? it gets truncated to length 0 β€” like, wiped, empty, gone, periodt πŸ’€
  • if it didn't exist? it gets created, with mode 0600 πŸ‘‘

and if something goes wrong 😭 io_createfile sets errno to indicate the error and returns 0. it does not create a new descriptor, and it does not touch d. main character boundaries, honestly πŸ™ˆ

⚠️ okay but fr fr β€” even when it fails, it may have truncated or created the file. so like, the file could lowkey already be changed even though you got a 0 back. be aware, bestie, that's the fine print and it's important πŸ’…

🌈 SEE ALSO 🌈

the whole file-io friend group, obsessed 🫢


that's the page, bestie πŸ’œ it's from the Library Functions Manual, and yeah, it's just called io_createfile(3) β€” go forth and create files responsibly, mwah πŸ˜­βœ¨πŸ’–