SDL_atof(3)

✨ SDL_atof β€” bestie's guide to turning a string into a double ✨

okay so you know what's up: this is SDL_atof(3), part of the SDL3 FUNCTIONS crew, and she's here to parse a double out of a string for you. no drama, no fuss, just vibes and floating point πŸ’…


🌸 NAME 🌸

SDL_atof β€” parse a double from a string. literally that's it, that's her job πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_stdinc.h>

double SDL_atof(const char *str);

one header, one function, one const char *, one double coming right back at you ✨


πŸ’– DESCRIPTION πŸ’–

the way that this one is so simple... πŸ₯Ή

calling SDL_atof(str) is equivalent to calling SDL_strtod(str, NULL). that's the whole tea, bestie. same result, same energy, just a shorter name for when you don't need that second argument.


🧚 FUNCTION PARAMETERS 🧚

  • str β€” the null-terminated string you want it to read. must not be NULL β€” like, seriously, don't. 🫢

πŸ‘‘ RETURN VALUE πŸ‘‘

you get back the parsed double. that's the prize, that's the crown, that's the whole point ⭐


🌈 THREAD SAFETY 🌈

it is safe to call this function from any thread. go wild, queen, thread it from everywhere πŸ”₯


⭐ AVAILABILITY ⭐

this one's been around since SDL 3.2.0. vintage-ish but make it fresh πŸ’œ


πŸŽ€ SEE ALSO πŸŽ€

the whole parse-a-number-into-a-thing family, all iconic, all obsessed with each other fr fr πŸ“


ok that's the page!! go forth and convert your strings, bestie πŸ’–

and that's a wrap on the Simple Directmedia Layer production, version SDL 3.4.18, page SDL_atof(3). no cap, that's the sign-off πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from