I am looking for a way to convert an int to a string of a given length. If the representation of the number is shorter, it should be zero-filled.
I.e., what I'd like to see:
snprintf(buffer, 3, "%d", 5); -> 005
snprintf(buffer, 2, "%d", 55); -> 55
Actually, snprintf(buffer, 3, "%d", 5)
; just return 5 in string.
Is there a simple way to do this ?