fmt_humank(3)
β¨ fmt_humank β¨
okay bestie, sit down, hydrate, because this one is adorable and you're gonna use it literally every day π
π NAME π
fmt_humank β write a human readable ASCII representation of a long integer
π¦ SYNTAX π¦
#include <libowfat/fmt.h>
size_t fmt_humank(char *dest,unsigned long long source);
πΈ DESCRIPTION πΈ
so here's the vibe: fmt_humank writes a human readable ASCII representation of source to dest, and then it hands you back the number of bytes it wrote. that's the whole thing. she's simple, she's elegant, she ate π
the result looks like the file size output of ls -h, no cap:
1024becomes"1.0k"1048576becomes"1.0M"- and so on for
"G"and"T"π₯
one thing to know: fmt_humank does not append \0. nope. not even a little. it writes the digits and dips, so if you need a null terminator that's a you problem, bestie π
and if dest equals FMT_LEN (i.e. is zero), then fmt_humank returns the number of bytes it would have written. it's giving "window shopping" energy β you get the size without the actual output π
also, the output offmt_humankcan not exceed11(assumingunsigned long longhas 64 bits). so budget for that and you're golden π
π SEE ALSO π
fmt_human(3)scan_humank(3)
and that's the whole page, fr fr π«Ά this little icon lives in the Library Functions Manual and she's fmt_humank(3) through and through β go format something pretty with her πβ¨π
π¦ 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