I want to add a variable of leading zero\'s to a string. I couldn\'t find anything on Google, without someone mentioning (s)printf, but I want to do this without (s)printf.<
memcpy(target,'0',sizeof(target)); target[sizeof(target)-1] = 0;
Then stick whatever string you want zero prefixed at the end of the buffer.
If it is an integer number, remember log_base10(number)+1 (aka ln(number)/ln(10)+1) gives you the length of the number.
log_base10(number)+1
ln(number)/ln(10)+1