fmt_xlong(3)
π fmt_xlong(3) β a whole vibe from the Library Functions Manual π¦
okay bestie sit DOWN because today we're talking about fmt_xlong, and honestly? she's giving quiet-legend energy. no cap. β¨
πΈ NAME πΈ
fmt_xlong β write a hexadecimal ASCII representation of an unsigned long integer π
like. she takes your big ol' number and turns it into pretty little letters and digits. that's the whole job. iconic.
π SYNTAX π
lowkey the important part, so pay attention bestie:
#include <libowfat/fmt.h>
size_t fmt_xlong(char *dest,unsigned long source);
that's it. two args. no drama. π«Ά
β¨ DESCRIPTION β¨
so here's the tea, fr fr:
fmt_xlong writes an ASCII representation of source to dest β and when we say ASCII representation we mean the characters '0' to '9' and 'a' to 'f', base 16, hexadecimal, the whole shebang. π
and THEN, because she's thoughtful like that, she returns the number of bytes written. so you always know exactly how much she gave you. main character behavior honestly.
β οΈ ok but here's the thing:fmt_xlongdoes not append\0. not even a little one. she is NOT null-terminating for you. if you need that, that's a you problem, bestie. plan accordingly. π
now for the fun part β the special case π
- If
destequalsFMT_LEN(i.e. is zero),fmt_xlongreturns the number of bytes it would have written. so she's like "no i'm not writing anything, but here's how long it woulda been" and honestly? respect. π
and for convenience β because the libowfat girlies love convenience β fmt.h defines the integer FMT_XLONG to be big enough to contain every possible fmt_xlong output plus \0. so if you're allocating a buffer, that's your number. use it. love it. don't do math in your head. π
π SEE ALSO π
scan_xlong(3)β the reverse queen, the one who reads it back. iykyk. π
that's the whole page bestie, no filler, no fluff, just fmt_xlong being exactly what she is. go forth and hex. π₯
this lil gem comes to you straight out of the Library Functions Manual, page fmt_xlong(3) β same title in the header, same title in the footer, because symmetry is a serve. no version string, no date, just vibes. πβ¨πΈπ¦ππ
π«Ά
π¦ 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