multiple file open for data logging

Hi Guys!,

I have to save multiple intervals of an experiment into multiple files with same name with interval number attached to it..

How can I handle the naming??,

It would be of great help if someone show me an example..

let's say:
1
2
3
4
5
        for (i=0;i<10;i++){        
        sprintf(fpath,"%s\\%s.dat",rootdir,fname);
	pFile = fopen (fpath, "wb");
}
You're on the right track. The only thing you're missing is appending the file number to the file name.

1
2
3
4
for (i=0;i<10;i++)
{    sprintf (fpath,"%s\\%s%d.dat", rootdir, fname, i);
	pFile = fopen (fpath, "wb");
}

Topic archived. No new replies allowed.