I need to convert an unsigned 64-bit integer into a string. That is in Base 36, or characters 0-Z. ulltoa does not exist in the Linux manpages. But sprintf DOES. How do I use sprintf to achieve the desired result? i.e. what formatting % stuff?
Or if snprintf does not work, then how do I do this?
You can always just write your own conversion function. The following idea is
stolen fromheavily inspired by this fine answer:This will return a pointer to a null-terminated string containing the base36-representation of
n, placed in a buffer that you provide. Usage:If you want and you’re single-threaded, you can also make the char buffer static — I guess you can figure out a suitable maximal length: