Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dirent.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, char **argv) {
- DIR *d;
- struct dirent *child;
- if (argc != 3) exit(1);
- if ((d = opendir(argv[1])) == NULL) exit(1);
- while ((child = readdir(d)) != NULL) {
- if (child->d_type == DT_REG && strstr(child->d_name, argv[2])) printf("%s\n", child->d_name);
- }
- closedir(d);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement