SDL_strtoll(3)
π SDL_strtoll π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, page SDL_strtoll(3) β she parses a long long out of a string and she does it flawlessly. β¨
π NAME π
SDL_strtoll β parse a long long from a string. that's it, that's the whole job, and she ate. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
long long SDL_strtoll(const char *str, char **endp, int base);
π¦ DESCRIPTION π¦
so here's the vibe. if str starts with whitespace, those whitespace characters get skipped before she even attempts to parse the number. she's not gonna let a lil space ruin the moment, she's better than that. π«Ά
and if the parsed number does not fit inside a long long? the result gets clamped to the minimum and maximum representable long long values. no cap. she's not gonna overflow on you, she's just gonna give you the biggest or smallest thing she's got and move on. iconic behaviour honestly. π
β FUNCTION PARAMETERS β
strβ the null-terminated string to read. and bestie, she means it: this must not beNULL. π«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 you can see exactly where she stopped reading, iykyk. πbaseβ the base of the integer to read. supported values are0and2to36inclusive. and if it's0, the base gets inferred from the number's prefix:0xfor hexadecimal,0for octal, decimal otherwise. she's reading the room (and the prefix). π₯
π RETURN VALUE π
returns the parsed long long, or 0 if no number could be parsed. simple, clean, no drama. (well β 0 is also a valid parse, so like, read endp if you need to tell them apart, that's the whole point of her.) π
π THREAD SAFETY π
it is safe to call this function from any thread. she's multithreaded-friendly, she contains multitudes. β¨
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older... bestie. upgrade. π
π SEE ALSO π
and that's the whole page, babe. this lil gem lives in Simple Directmedia Layer land, version SDL 3.4.18, page SDL_strtoll(3). go forth and parse responsibly. mwah. ππ§π
π¦ 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