SDL_uitoa(3)
π SDL_uitoa(3) π
okay so bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we turn numbers into glow-up strings. this one's called SDL_uitoa and it's giving "unsigned int, but make it text" β¨
πΈ NAME πΈ
SDL_uitoa β Convert an unsigned integer into a string. that's it, that's the whole job, and she does it flawlessly π
π SYNOPSIS π
#include <SDL3/SDL_stdinc.h>
char * SDL_uitoa(unsigned int value, char *str, int radix);
like look at her. three args, zero drama. iconic.
π¦ DESCRIPTION π¦
so the way this works is you have to tell her what radix to use for the string format, no skipping that part. say 10 and you get a decimal number, 16 and boom, hexadecimal, etc. the radix must be in the range of 2 to 36. that's the whole range, don't try to be cute and go outside it.
β οΈ NOT ME ABOUT TO RUIN THE VIBE BUT β this function will overflow a buffer if str is not large enough to hold the output! like literally, she does not check, she does not clamp, she just writes. π
if you want the safe route (and honestly, slay), it may be safer to use SDL_snprintf to clamp output, or SDL_asprintf to allocate a buffer. otherwise, it doesn't hurt to allocate much more space than you expect to use β and don't forget null terminator bytes, etc. those little \0 besties are non-negotiable fr fr.
π«Ά FUNCTION PARAMETERS π«Ά
valueβ the unsigned integer to convert. this is the number getting its string era π«strβ the buffer to write the string into. your responsibility, your problem, allocate generously π₯²radixβ the radix to use for string generation. 2 to 36, remember π
β RETURN VALUE β
Returns str. that's it. she hands you back your own buffer, all dressed up. π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. yes bestie, any thread, all the threads, go off π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older... girl. upgrade. π
π SEE ALSO π
the whole conversion friend group, go say hi π
and that's the page!! brought to you by Simple Directmedia Layer, version SDL 3.4.18, SDL_uitoa(3) β stay converted, stay safe, allocate more than you think you need, 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