Convert a long integer into a string.
Defined in <SDL3/SDL_stdinc.h>
char * SDL_ltoa(long value, char *str, int radix);
long | value | the long integer to convert. |
char * | str | the buffer to write the string into. |
int | radix | the radix to use for string generation. |
(char *) Returns str
.
This requires a radix to specified for string format. Specifying 10 produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2 to 36.
Note that this function will overflow a buffer if str
is not large enough to hold the output! 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 possible negative signs, null terminator bytes, etc).
It is safe to call this function from any thread.
This function is available since SDL 3.1.3.