buffer_putlong(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_putlong β€” the glow-up your signed longs deserve πŸ’–

okay so bestie, we're in section 3 of the Library Functions Manual, and today's main character is buffer_putlong. it's giving "quietly essential" fr fr. let's get into it ✨


🌸 NAME 🌸

buffer_putlong β€” write a decimal ASCII representation of a signed long integer to buffer

like, you hand it a number, it hands back the digits as text, and it drops that text straight into a buffer. no drama, no fuss, just vibes πŸ’…


✨ SYNTAX ✨

#include <libowfat/buffer.h>

int buffer_putlong(buffer* b,signed long x);

yeah that's the whole thing. include the header, call the function, b is your buffer and x is your signed long. periodt 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: buffer_putlong is similar to passing the result of fmt_long to buffer_put.

that's literally it. that's the whole description. you fmt_long the number, you buffer_put the string, and this function is just that combo meal already assembled for you. iconic behaviour honestly πŸ‘‘


πŸŽ€ RETURN VALUE πŸŽ€

  • 0 β€” everything is fine, we ate, no crumbs, slay ✨
  • -1 β€” error, and it's setting errno so you know what went wrong 😭
bestie please actually check the return value. -1 is not a vibe, it's a cry for help.

🌈 SEE ALSO 🌈

like go read fmt_long(3) if you wanna see where the number-to-text magic actually happens, and buffer_flush(3) when you finally wanna push all that buffered goodness out into the world 🧚


and that's the whole page, bestie!! it lives in the Library Functions Manual as buffer_putlong(3), section 3, exactly where you found it πŸ’œ go forth, write your longs, stay decimal, stay hydrated πŸ“πŸŒΈπŸ’–