I have a dummy question. I would like to print an integer into a buffer padding with 0 but I cannot sort it out the sprintfformat.
I am trying the following
A fairly effective version that doesn't need any slow library calls:
#include
void uint_tostr (unsigned int n, size_t buf_size, char dst[buf_size])
{
const size_t str_size = buf_size-1;
for(size_t i=0; i
This can be optimized further, though it is still probably some hundred times faster than sprintf as is.