SDL_ulltoa(3)

✨ SDL_ulltoa β€” the glow-up from unsigned long long to string ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual πŸ’– this one is SDL_ulltoa(3), and it is literally the moment your giant unsigned number gets a whole new string identity. no cap.


🌸 NAME 🌸

SDL_ulltoa β€” convert an unsigned long long integer into a string. yes queen, it's giving "number to text" realness πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_stdinc.h>

char * SDL_ulltoa(unsigned long long value, char *str, int radix);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: you must specify a radix for the string format, like it's not optional, it's the whole vibe. 10 gives you a decimal number, 16 gives you hexadecimal, etc. and the radix has to be in the range of 2 to 36. periodt.

⚠️ not me warning you dramatically: this function will overflow a buffer if str is not large enough to hold the output! like, it will just keep writing and not care. 😭 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. fr fr.

πŸ’œ FUNCTION PARAMETERS πŸ’œ

  • value β€” the unsigned long long integer to convert. the main character, the number itself πŸ‘‘
  • str β€” the buffer to write the string into. this is where the magic lands, so make it big enough bestie πŸ™ˆ
  • radix β€” the radix to use for string generation. base 2 to 36, pick your fighter ⭐

🌈 RETURN VALUE 🌈

Returns str. that's it, that's the return. it hands you back the same buffer you passed in, now with a fresh string inside πŸ’–


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. so go off, multitask, let all your threads have their moment πŸ”₯


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL 3.2.0. so if you're on an older SDL, bestie... it's not giving. upgrade πŸ’…


πŸ“ SEE ALSO πŸ“

the whole conversion friend group, obsessed 🫢


and that's the whole page, no notes. this was written under the <strong>Simple Directmedia Layer</strong> banner for <strong>SDL 3.4.18</strong> β€” mwah, slay, bye bestie πŸ’œβœ¨

πŸ“¦ where this page comes from