strtoimax(3)
π strtoimax(3) β bestie edition π
okay so you know strtol(3)? this is literally that but the number gets to be huge. we're in the Library Functions Manual today, and the manual name is strtoimax β say hi bestie π«Ά
β¨ NAME β¨
strtoimax, strtoumax β string to [u]intmax_t
like. you hand it a string. it hands you back the biggest integer type the C library can give you. it's giving glow up for your parsing code π
π LIBRARY π
Standard C library (libc, -lc)
the classic. the blueprint. the one and only π
πΈ SYNOPSIS πΈ
#include <inttypes.h>
intmax_t strtoimax(const char *restrict nptr, char **restrict endptr,
int base);
uintmax_t strtoumax(const char *restrict nptr, char **restrict endptr,
int base);
two functions, one header, zero drama β¨
π¦ DESCRIPTION π¦
okay so the tea:
these two are literally just like strtol(3) and strtoul(3), except β and this is the whole plot twist β they return a value of type intmax_t and uintmax_t, respectively.
that's it. that's the function. same behavior, biggest-possible-integer energy. no cap π₯
so like, if you already know how strtol(3) works (which you do, because you're a genius), you already know how this works. go off π
π« RETURN VALUE π«
- it worked? β you get the converted value back. slay.
- nothing was found to convert? β zero. that's it. that's the answer. π
- overflow or underflow? β you get back
INTMAX_MAXorINTMAX_MINorUINTMAX_MAX(depending on which way it went off the rails), anderrnois set toERANGE.
β οΈ bestie. pay attention toerrno. it is not fooling around. check it before you trust the number.INTMAX_MAXcould mean "the actual answer is INTMAX_MAX" or it could mean "we blew past the limit, sorry girl." seterrnoto0first, always, fr fr π
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7).
strtoimax(),strtoumax()β Thread safety:MT-Safe locale
translation: it's MT-Safe locale, which means the safety depends on your locale vibe. you can thread it, just mind the locale, iykyk π§
π STANDARDS π
C11, POSIX.1-2008.
certified. standardized. iconic. officially canon β¨
π HISTORY π
POSIX.1-2001, C99.
so it's been around. it's not new here. it's a veteran, and it ate every single time π
π SEE ALSO π
imaxabs(3)β absolute value, but maximaxdiv(3)β division, but maxstrtol(3)β the blueprintstrtoul(3)β the unsigned blueprintwcstoimax(3)β the wide-character cousin π¦
that's the whole page bestie, no notes π
signing off from Linux man-pages 6.20, dated 2026-07-26 β catch you in the next strtoimax(3) glow up β¨π«Άπ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- Copyright 2003, Andries E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms