-
Updating file name
Hey,
Ive written a program in c/opengl and it creates a .tga file of each frame to make a short animation. However, im wanting to 'update' the file name it creates in the function each time its called.
eg:
call 1: name=1.tga
call 2: name=2.tga
...
call n: name=n.tga
How might I go about doing this?
-
Code:
#include <stdio.h>
int CreateFile(void)
{
static int counter;
char buf[BUFSIZ];
counter++;
sprintf(buf, "%d.tga", counter);
puts(buf);
return 0;
}
int main(void)
{
int i;
for (i = 0; i < 10; i++)
CreateFile();
return 0;
}
-
yeh! daddy cool :D it works, ty :)