SDL_strtod(3)
π SDL_strtod(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_strtod β she parses a double out of a string and honestly? she's doing it on her own terms. π
β¨ NAME β¨
SDL_strtod β parse a double from a string. that's it, that's the whole job. π¦
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
double SDL_strtod(const char *str, char **endp);
π DESCRIPTION π
so here's the tea, and you're gonna wanna sit down for this one: this function makes fewer guarantees than the C runtime strtod. like, she's the chill lowercase cousin of the big C library one. not me telling you the fine print before you even get attached π
- Only decimal notation is guaranteed to be supported. The handling of scientific and hexadecimal notation is unspecified.
- Whether or not
INFandNANcan be parsed is unspecified. - The precision of the result is unspecified.
fr fr, "unspecified" means don't come crying to her if it doesn't do the thing. she never promised. lowkey iconic of her.
π«Ά FUNCTION PARAMETERS π«Ά
strβ the null-terminated string to read. Must not beNULL. π«endpβ if notNULL, the address of the first invalid character (i.e. the next character after the parsed number) will be written to this pointer. so she tells you exactly where she stopped vibing with your string β¨
β RETURN VALUE β
Returns the parsed double, or 0 if no number could be parsed. zero, queen. slay π
π THREAD SAFETY π
It is safe to call this function from any thread. multitasking queen, we love to see it π
π§ AVAILABILITY π§
This function is available since SDL 3.2.0. so if you're on something olderβ¦ no she's not there yet, sorry bestie π
π₯ SEE ALSO π₯
the whole friend group, literally all of them, go say hi π
and that's the page!! brought to you by Simple Directmedia Layer, running SDL 3.4.18 β mwah, take care of her, and remember: decimal only unless stated otherwise πβ¨π
π¦ 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