Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
WIN32_FIND_DATA ffdata;
HANDLE ffind;
int i;
ffind=FindFirstFile("*.*", &ffdata);
printf ("The first file found is %s\n", ffdata.cFileName);
i=strcmp("lilo3.exe",ffdata.cFileName);
while (FindNextFile(ffind, &ffdata) != 0 && (i!=0)) {
FindNextFile(ffind, &ffdata);
printf("%s",ffdata.cFileName);
i=strcmp("lilo3.exe",ffdata.cFileName);}
FindClose(ffind);
return 0;
}
in this try my goal is to find lilo3.exe file
this is my try with <dirent.h>
Code:
#include <stdio.h>
#include <dirent.h>
int main()
{
struct dirent *seek;
DIR *dir;
dir = opendir("D:\\");
while ((seek = readdir(dir)&& (strcmp ( seek->d_name , " lilo3.exe ") != 0)))
{
printf("FICHIER: %s\n", seek->d_name);
}
closedir(dir);
return 0;
}