SDL_strtoul(3)
β¨ SDL_strtoul β¨
okay bestie, welcome to the SDL_strtoul(3) page from the SDL3 FUNCTIONS era π this one's a little string-to-number glow-up machine and honestly? it's giving useful.
πΈ NAME πΈ
SDL_strtoul β parse an unsigned long from a string. that's it, that's the vibe π«Ά
π SYNOPSIS π
#include <SDL3/SDL_stdinc.h>
unsigned long SDL_strtoul(const char *str, char **endp, int base);
π DESCRIPTION π
so like. if str starts with whitespace, those whitespace characters get skipped before it even tries to parse the number. no cap, it's just being polite and looking past the leading blanks β¨
and if the parsed number does not fit inside an unsigned long?? the result gets clamped to the maximum representable unsigned long value. not an error, not a crash, just a lil ceiling moment π it simply refuses to go past the max.
π¦ FUNCTION PARAMETERS π¦
strβ the null-terminated string to read. must not beNULL. like, genuinely, don't do that πendpβ if it's notNULL, the address of the first invalid character (i.e. the next character after the parsed number) gets written to this pointer. so it's your little "and this is where the number stopped" receipt π§Ύbaseβ the base of the integer to read. supported values are0and2to36inclusive. if it's0, the base gets inferred from the number's prefix (0xfor hexadecimal,0for octal, decimal otherwise). iconic detective behaviour π
π RETURN VALUE π
returns the parsed unsigned long, or 0 if no number could be parsed. yes, that means 0 is doing double duty, but that's just how it is bestie π
π§ THREAD SAFETY π§
it is safe to call this function from any thread. go wild, multi-threaded queen π
β AVAILABILITY β
this function is available since SDL 3.2.0. so if you're on something older, that's a no from me π
π₯ SEE ALSO π₯
and that's the whole page, bestie!! this lil cutie comes to you from Simple Directmedia Layer, version SDL 3.4.18, dated SDL_strtoul(3) β mwah, go parse something β¨ππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms