Without resorting to standard library utoa, I’m looking for source code of utoa so I may customise it for specific project. I have unsigned integer (32 bits) with output such as 0xFFFF_FFFF
I also looking for source code for unsigned integer and half word to string in binary format.
Try this:
You call it with a pointer to the end of a caller-provided buffer, and the function returns the pointer to the beginning of the string. The buffer should have length at least
3*sizeof(int)+1to be safe.Of course this is easily adapted to other bases.