SDL_atoi(3)
π SDL_atoi β the "string goes in, number comes out" glow-up π
okay bestie, welcome to the SDL3 FUNCTIONS manual, page SDL_atoi(3). this one is short, sweet, and lowkey iconic. sit down, grab a boba, let's get into it β¨
πΈ NAME πΈ
SDL_atoi β parse an int from a string. that's it. that's the whole job. fr fr.
π SYNOPSIS π
#include <SDL3/SDL_stdinc.h>
int SDL_atoi(const char *str);
like. look at her. one include, one function, one const char *. minimalist queen π
π¦ DESCRIPTION π¦
okay so here's the tea: calling SDL_atoi(str) is equivalent to this:
(int)SDL_strtol(str, NULL, 10);
that's literally it. no secret sauce, no hidden extra steps, no plot twist. she's just SDL_strtol with base 10 and a NULL end pointer, then the result gets cast to int. the way that she does the thing and then hands it over π«Ά
so if you were expecting something wild, nope. she's a wrapper. a cute little wrapper. and honestly? we love a function that knows exactly what she is π
π FUNCTION PARAMETERS π
strβ the null-terminated string you want her to read. must not beNULL. like, genuinely, do not. that's the one boundary bestie π«
β RETURN VALUE β
she returns the parsed int. that's the gift. that's the whole present π
π₯ THREAD SAFETY π₯
go off. it is safe to call this function from any thread. main character energy in every single thread, no cap π
β¨ AVAILABILITY β¨
this function has been available since SDL 3.2.0. so if you're on anything older... bestie. upgrade. it's giving ancient π
π§ SEE ALSO π§
the whole number-parsing friend group. they all hang out. iykyk πΈ
and that's the page!! brought to you by Simple Directmedia Layer, version SDL 3.4.18, SDL_atoi(3). thanks for coming to my ted talk, go parse something 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