I have some numbers of different length (like 1, 999, 76492, so on) and I want to convert them all to strings with a common length (for example, if the length is 6, then tho
There are many ways of doing this. The simplest would be:
int n = 999; char buffer[256]; sprintf(buffer, "%06d", n); string str(buffer);