I'm trying to write code so that I can search through a folder and determine the last date that each file was modified. I have the code to determine the date that the files were modified, but I dont have code to get the filenames from the folder, the filenames are not always the same. So far, I have the following code.
Code:
struct ffblk finfo;
char array[100][20]; /* array to store 100 file names */
int done;
int counter = 0 , i;
printf("File names stored in the array:\n");
done = findfirst("*.*",&finfo,0);
while (!done)
{
strcpy(array[counter++] , finfo.ff_name);
done = findnext(&finfo);
}
for(i = 0; i < counter ; i++)
printf("%s\n" ,array[i]);
getch();
The problem I have is that I was supposed to use the dir.h header file. However, my Visual Studio version doesnt have that header file. So I cant use the findfirst or the findnext functions. So does anyone know where I can download the dir.h header file. Or is there another way that I can get the filenames from a directory?