I have a list of several thousand files that I need to merge selectively into one file. The files are in three categories, called
where ???? is an integer that increases linearly, ei
I am wondering how I can build a loop that opens these files in order based on the index. Basically my question is, how do I turn the index I am using in my for loop into a string of four integers that ends in my index and then gets .dat appended to it?
for example, if my index == 108, then the string I need would be
0108.dat, and I could say
Also, I hae never done system calls in C. How can I call the file system to find out how many of these files there are in the current directory at runtime? I am googling this as we speak, so no smartass comments lol, I just thought posting here might speed up the search.Code:afile = fopen("strcat(a,indexstring)",r");
I am just starting the code now, so suggestion are appreciated in the 20 minutes before I go home from work
I'll post more details tomorrow as my code evolves.
EDIT: looks like system() is what I want (go figure?)
would sprintf with a format string to force 4 digits work to make the index a string?