openreadclose(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay so this is openreadclose(3), straight from the Library Functions Manual, and it's lowkey iconic: it reads a whole file into a stralloc. no cap. πŸ’…

  • openreadclose β€” read a whole file into a stralloc πŸŽ€

🧚 SYNTAX 🧚

       #include <libowfat/openreadclose.h>

       ssize_t openreadclose(const char *filename,
                  stralloc* sa,size_t bufsize);

Include that header, bestie, and you're ready to go. 🫢

πŸ’– DESCRIPTION πŸ’–

openreadclose opens the file filename for reading and reads the whole content into the stralloc sa. It reads the file in chunks of bufsize bytes size. Like, chunk by chunk, but make it fashion. ✨

Here's the return vibe check, fr fr:

  • If everything worked fine, openreadclose returns 1. Slay. Periodt. βœ…
  • If the file did not exist, openreadclose returns 0. Not found, no drama. πŸ«₯
  • On every other error, openreadclose returns -1 and sets errno appropriately. It's giving "something went wrong, check errno." πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹


That's the whole page, bestie. From the Library Functions Manual, section 3. Bye πŸ’–βœ¨