SDL_lltoa(3)

πŸ’– SDL_lltoa πŸ’–

okay bestie, welcome to the SDL_lltoa(3) page, part of the SDL3 functions lineup ✨ this one is lowkey iconic, it turns your big ol' number into a string. let's get into it 🫢


🌸 NAME 🌸

SDL_lltoa β€” Convert a long long integer into a string.


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

char * SDL_lltoa(long long value, char *str, int radix);

πŸŽ€ DESCRIPTION πŸŽ€

so basically, this function takes your long long and writes it out as a string. but you HAVE to tell it a radix β€” that's the number base for the string format. so like, radix 10 gives you a decimal number, 16 gives you hexadecimal, etc. etc. πŸ’… and it must be in the range of 2 to 36. no exceptions, that's the vibe check.

⚠️ GIRLIE BE CAREFUL β€” this function WILL overflow your buffer if str isn't big enough to hold the output! it's giving risky fr fr 😭

if you wanna be safe, it might be safer to use SDL_snprintf to clamp the output, or SDL_asprintf to allocate a buffer for you. otherwise? honestly it doesn't hurt to allocate way more space than you think you need β€” and don't forget the possible negative signs, null terminator bytes, all of that πŸ’€ they're sneaky and they take up room.


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • value β€” the long long integer you wanna convert. your main character number πŸ’–
  • str β€” the buffer you're writing the string into. it's gotta be big enough bestie, we talked about this πŸ™ˆ
  • radix β€” the radix to use for string generation. between 2 and 36, periodt ✨

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns str. that's it, that's the whole thing. she gives you back your own buffer 🫢


🌈 THREAD SAFETY 🌈

It is safe to call this function from any thread. no cap, every single one πŸ’…βœ¨


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on anything older... bestie, it's not there 😭


🌸 SEE ALSO 🌸

go read those too, they're all siblings in the same little number-to-string family πŸ§šπŸ’œ


and that's the whole page, bestie!! mwah πŸ’‹ this was written by Simple Directmedia Layer for SDL 3.4.18, dated SDL_lltoa(3) β€” go forth and convert your long longs responsibly πŸŽ€βœ¨

πŸ“¦ where this page comes from