Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <sys/types.h>
  4. #include <dirent.h>
  5. #include <string.h>
  6. #include <ctype.h>
  7.  
  8. int main()
  9. {
  10. char *keywords="flag hello keyword";
  11.  
  12. DIR *dir;
  13. struct dirent *entry;
  14.  
  15. char *dirinput="./search/";
  16. dir = opendir(dirinput);
  17. if (dir == NULL)
  18. {
  19. perror("error dir open =(");
  20. return 1;
  21. }
  22.  
  23. while ( (entry = readdir(dir)) != NULL)
  24. {
  25. char *name = entry->d_name;
  26. printf("%s\n", name);
  27. if (strcmp(name,"..")==0 || strcmp(name,".")==0)
  28. {
  29. continue;
  30. }
  31. ///функции
  32. char way[50] = "./search/";
  33. strcat(way, name);
  34. printf("%s\n", way);
  35.  
  36. FILE *file;
  37. file = fopen(way,"r");
  38. if (file == NULL)
  39. {
  40. perror("error file open )=");
  41. return 1;
  42. }
  43.  
  44. char *word;
  45. for (int i=0; i<strlen(keywords); i++)
  46. {
  47. if (!isspace(keywords))
  48. {
  49.  
  50. }
  51. }
  52.  
  53. while (getc(file) != EOF)//
  54. {
  55.  
  56. }
  57.  
  58. fclose(file);
  59.  
  60. }
  61. closedir(dir);
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement