sprintf(dest, "%4d", ival); // integer will be printed and occupy (at least) 4 positions (if ival is 12345, it will occupy 5 positions).
sprintf(dest, "%04d", ival); // integer will be printed and occupy (at least) 4 positions, but leading 0's will be used if the output is shorter than 4.
OBS OBS :
%d means you will supply integer argument to sprintf, not floating points, or strings or .....
There are lots of possibilites - you need to check documentation :
"Format Specification Fields: printf and wprintf Functions"
<Also, if I use "char* currentPosition" to declare my string, I get an application error. Why is that?
>
You can't just put in a pointer ... it needs to point to some memory owned by your application.
Allocate a buffer and let the pointer point to this buffer :
char buf[256];
char * CurrentPosition = buf;
sprintf(CurrentPosition, "..................", ....);
/JOlesen