buffer_getn(3)
π buffer_getn(3) π
okay bestie, welcome to the Library Functions Manual corner of the group chat πΈ this one's about buffer_getn β she's a libowfat girlie and she's here to grab you some binary data π
β¨ NAME β¨
buffer_getn β read binary data from buffer π«Ά
π SYNTAX π
#include <libowfat/buffer.h>
ssize_t buffer_getn(buffer* b,char* x,size_t len);
π¦ DESCRIPTION π¦
so like, buffer_getn copies data into x[0], x[1], ... all the way to x[len-1] β straight outta the buffer π and it'll call buffer_feed as many times as it needs to, whenever it needs more. then it hands you back len. that's the whole vibe. slay β¨
BUT. okay. listen. π if a read error happens, buffer_getn returns -1 and sets errno appropriately. and here's the unhinged part β it may then have put any number between 0 and len in the buffer, and you literally cannot tell. no cap. you just don't get to know.
π¨ that little detail is exactly why this function is only useful if you don't care when an error occurs. it's giving "we'll find out later" energy. if you do care (and honestly, valid), use buffer_get instead. periodt.
and if the read operation signals end-of-file before len bytes were read? then buffer_getn returns the number of bytes it actually read from the buffer before end-of-file hit. so like, a short count. she tells you how far she got π§
π SEE ALSO π
and that's the whole page, bestie β no date, no version, no dramatic outro. the footer just signs off with <code>buffer_getn(3)</code> again like a girl who only answers with her own name π go read the buffer, she's waiting π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· 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 noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- 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