My C is a bit rusty but sprintf is your friend here.
Try:
Code:
char buffer[10];
for(int i=0; i<10000; i++) {
sprintf(buffer, "%05d.png", i);
/* write file contents */
}
the %05d is a format string that tells the compiler to format a string containing a decimal integer (the d) to a width of 5 characters (the 5) and to pad using a 0 character (the 0) and then to append that with .png.
I dont have a C compiler anymore so I cant test this but it should be right, google will find you literally hundreds of guides to format strings with printf and sprintf though.
Hope this helps