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

πŸ’– fmt_uint(3) πŸ’–

okay bestie, welcome to the Library Functions Manual ✨ today's main character is fmt_uint β€” the little function that turns your unsigned integer into an actual ASCII glow-up. no cap.


🌸 NAME 🌸

fmt_uint β€” write an ASCII representation of an unsigned integer 🫢


✨ SYNTAX ✨

#include <libowfat/fmt.h>

size_t fmt_uint(char *dest,unsigned int source);

like. that's it. two args. she's lowkey simple but she ATE πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: fmt_uint writes an ASCII representation ('0' to '9', base 10) of source to dest, and then returns the number of bytes it wrote. slay.

important!! fmt_uint does not append \0. not even a little one. no null terminator, no goodnight kiss. if you need one you're gonna have to handle that yourself, bestie 😭

and if dest equals FMT_LEN (i.e. it's zero), then fmt_uint doesn't write anything at all β€” instead it returns the number of bytes it would have written. it's giving "let me just tell you how much space I'd need" energy. iconic for sizing your buffer before you commit, iykyk ✨

for convenience, fmt.h defines the integer FMT_ULONG to be big enough to contain every possible fmt_uint output plus \0. so that's your safe little comfort blanket, use it πŸŽ€


πŸ’œ SEE ALSO πŸ’œ

  • scan_uint(3) β€” the reverse queen, goes the other direction 🌈
  • fmt_uint0(3) β€” her sibling, go say hi ⭐

and that's the whole page, babe πŸ’– no notes, no crumbs, she's perfect.

sign-off time πŸŽ€ β€” this was fmt_uint(3) from the Library Functions Manual, and the footer just says fmt_uint(3) again with no date or version attached, so like. we don't have a timestamp bestie, she's timeless πŸ’…βœ¨