readclose(3)

πŸ“¦
version 0.34 Β· 3 versions
, 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

🌸 readclose(3) 🌸

okay so bestie, welcome to the Library Functions Manual β€” manual name folded in, no cap β€” and today's main character is readclose(3). she's giving "read a whole file into a stralloc" energy and we are obsessed. πŸ’–βœ¨


✨ NAME ✨

readclose β€” read a whole file into a stralloc 🫢


πŸ“œ SYNTAX πŸ“œ

#include <libowfat/readclose.h>

int readclose(int fd,stralloc* sa,size_t bufsize);

πŸ’… DESCRIPTION πŸ’…

so readclose reads the whole content into the stralloc sa. yes, the whole content, she's not doing half measures. πŸ’€

the file is read in chunks of bufsize bytes size. that's the chunk size, periodt. πŸŽ€

if everything worked fine, readclose returns 0. slay. βœ…

on error, readclose returns -1 and sets errno appropriately. so if it's not giving 0, the errno tea is right there, bestie. 🚨


πŸ‘€ SEE ALSO πŸ‘€


signing off from the Library Functions Manual, where the footer just says readclose(3) πŸ’…βœ¨