fmt_xlonglong(3)
π fmt_xlonglong(3) β from the Library Functions Manual, bestie π
okay so you know how hex is literally the moment? yeah. this is that, but for the big big numbers. welcome to fmt_xlonglong, a function that lives in the Library Functions Manual and is here to turn your unsigned long long into lowercase hex letters like the absolute queen it is π
β¨ NAME β¨
fmt_xlonglong β write a hexadecimal ASCII representation of an unsigned long long integer π¦
β¨ SYNTAX β¨
lowkey the include first, always:
#include <libowfat/fmt.h>
size_t fmt_xlonglong(char *dest,unsigned long long source);
look at that signature. size_t coming back at you, dest and source doing their thing. iconic. π
β¨ DESCRIPTION β¨
so here's the vibe. fmt_xlonglong writes an ASCII representation of source into dest β and the alphabet it uses is '0' to '9' plus 'a' to 'f', base 16. that's it, that's the whole palette. and then it returns the number of bytes it wrote. so cute of it to report back π«Ά
one thing though: fmt_xlonglong does not append \0. nope. no null terminator. it is not your string-finishing bestie, it is your hex-writing bestie. you handle the \0 yourself, mwah π
and here's the lil plot twist for when you're just measuring: if dest equals FMT_LEN (i.e. it's zero), fmt_xlonglong returns the number of bytes it would have written. so you can vibe-check the length first and then actually do it. no cap. β¨
and for convenience β because the library loves you β fmt.h defines the integer FMT_XLONG to be big enough to contain every possible fmt_xlonglong output plus \0. so like. buffer sizing? solved. slay π
β¨ SEE ALSO β¨
- scan_xlonglong(3) β the other half of the situationship π₯
reminder bestie: no \0 gets appended. do not forget. do not make it weird. π
okay that's the whole page, sending you off with love from the Library Functions Manual and from fmt_xlonglong(3) itself β go write some hex, you gorgeous little unsigned long long π¦πΈπ
π¦ 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