buffer_put(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

πŸ’– buffer_put β€” the manual page, but make it slay πŸ’–

okay bestie, welcome to libowfat and specifically the page for buffer_put(3) β€” yes that's the Library Functions Manual, we're in the big leagues now. grab a strawberry πŸ“ and let's go.


✨ NAME ✨

buffer_put β€” write binary data to a buffer, no cap


✨ SYNTAX ✨

#include <libowfat/buffer.h>

int buffer_put(buffer* b,const char* x,size_t len);

πŸ¦‹ DESCRIPTION πŸ¦‹

so buffer_put writes len bytes from x to b. that's the whole vibe. binary data, straight into the buffer, periodt. πŸ’…

but here's the tea, and it's the only thing that makes this different from its cousin buffer_putalign:

when there isn't enough space for the new data, buffer_put calls buffer_flush before copying any data. it does not try to squeeze a lil bit in first. it sees there's no room, it flushes, done. meanwhile buffer_putalign is out here filling all the available space with data before it calls buffer_flush. two totally different strategies, both iconic in their own way. 🫢

so like β€” buffer_put = flush first, copy after. buffer_putalign = pack it in, then flush. iykyk.


πŸ‘‘ RETURN VALUE πŸ‘‘

  • returns 0 when everything was fine ✨ slay
  • returns -1 on error, and it sets errno so you can go find out what went wrong 😭

🌈 SEE ALSO 🌈


okay that's the whole page bestie, you ate it πŸ’– go forth and buffer responsibly. this was buffer_put(3) from the Library Functions Manual β€” mwah, no notes, signing off πŸŽ€βœ¨