SDL_ultoa(3)
β¨ SDL_ultoa β¨
okay bestie, welcome to `SDL_ultoa(3) β straight out of the SDL3 FUNCTIONS section of the manual, and honestly? it's giving "tiny function, big personality." π
πΈ NAME πΈ
SDL_ultoa β Convert an unsigned long integer into a string. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_stdinc.h>
char * SDL_ultoa(unsigned long value, char *str, int radix);
π DESCRIPTION π
okay so here's the tea, bestie: this one needs a radix, like, you have to specify it for the string format. no radix, no vibe check, no output. π
- specify
10β you get a decimal number β¨ - specify
16β you get hexadecimal π - etc. etc., you get the picture π
- and it must be in the range of 2 to 36. that's the whole window, no exceptions, periodt.
β οΈ okay but FR FR, listen up: this function will overflow a buffer if str is not large enough to hold the output! like, it will just keep writing. it does not care. it is not checking. π
so if you'd rather not experience that particular jump scare, it may be safer to use SDL_snprintf to clamp output, or SDL_asprintf to allocate a buffer. π«Ά
otherwise, honestly? it doesn't hurt to allocate much more space than you expect to use. like, spoil yourself. go big. and don't forget null terminator bytes, etc. β those little guys count too. π
π FUNCTION PARAMETERS π
valueβ the unsigned long integer to convert. the main character, the one we're turning into a string πstrβ the buffer to write the string into. this is where the magic lands, so make it roomy bestie πradixβ the radix to use for string generation. base 2 to base 36, pick your fighter β
π RETURN VALUE π
Returns str. that's it. it hands you back the same buffer you gave it. iconic, honestly. π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. π no drama, no locks, no fighting, we love a peaceful queen. β¨
β AVAILABILITY β
This function is available since SDL 3.2.0. π
π₯ SEE ALSO π₯
and that's the whole page, bestie!! π«Ά brought to you by Simple Directmedia Layer, running SDL 3.4.18, filed under SDL_ultoa(3). go forth and convert your unsigned longs 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