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_MAX or INTMAX_MIN or UINTMAX_MAX (depending on which way it went off the rails), and errno is set to ERANGE.
⚠️ bestie. pay attention to errno. it is not fooling around. check it before you trust the number. INTMAX_MAX could mean "the actual answer is INTMAX_MAX" or it could mean "we blew past the limit, sorry girl." set errno to 0 first, 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 πŸ‘‘


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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms