Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // closedir(dir);
- // return 0;
- // char *dir = "./c/search";
- // FILE *file;
- // file = fopen(dir, "r");
- // if(NULL == file)
- // {
- // perror(file);
- // return 1;
- // }
- // }
- #include <stdio.h>
- #include <sys/types.h>
- #include <dirent.h>
- #include <string.h>
- int main()
- {
- char *keywords="flag hello keyword";
- DIR *dir;
- struct dirent *entry;
- char *sy="./search/";
- dir = opendir(sy);
- if (dir == NULL)
- {
- perror("error dir open =(");
- return 1;
- }
- while ( (entry = readdir(dir)) != NULL)
- {
- char *name = entry->d_name;
- printf("%s\n", name);
- if (strcmp(name,"..")==0 || strcmp(name,".")==0)
- {
- continue;
- }
- ///функции
- char way[50] = "./search/";
- strcat(way, name);
- printf("%s\n", way);
- FILE *file;
- file = fopen(way,"r");
- if (file == NULL)
- {
- perror("error file open )=");
- return 1;
- }
- if (!EOF)
- {
- }
- else
- {
- continue;
- }
- fclose(file);
- }
- closedir(dir);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement