fmt_fill(3)
π fmt_fill(3) π
okay bestie, so this is a page from the Library Functions Manual, and it's literally about fmt_fill β the little icon that pads your string with spaces. no cap, it's giving "quietly carrying the whole alignment situation." let's get into it π«Ά
β¨ NAME β¨
fmt_fill β append spaces to a string πΈ
π SYNTAX π
#include <libowfat/fmt.h>
size_t fmt_fill(char *dest,
size_t srclen, size_t padlen,
size_t maxlen);
like, that's the whole vibe. five args, one job π
π¦ DESCRIPTION π¦
so fmt_fill appends padlen-srclen spaces to dest β but only if that number is positive, bestie. if it's not positive, it's not doing that. math is math. π§
dest is holding srclen bytes when you hand it over, okay? that's the situation it's working with.
it truncates the output only if the length would exceed maxlen. that's the only time. it's not out here truncating for fun. π
it returns the number of bytes it wrote. count them. slay. β¨
π¨ important:fmt_filldoes not append\0. it is not writing your null terminator for you. do not come for her about it. she simply does not do that.
and here's the iconic little plot twist: if dest equals FMT_LEN (i.e. is zero), fmt_fill returns the number of bytes it would have written. not wrote. would have. it's manifesting the byte count. no cap. π
π SEE ALSO π
go read those too, iykyk π
and that's the whole page, fr fr π shoutout to the Library Functions Manual for hosting this legend, and to fmt_fill(3) itself β no date stamp on this one bestie, just vibes and a page number. periodt. πβ¨
π¦ 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