123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include <dirent.h>
- #include <errno.h>
- #include <stdio.h>
- int main() {
- printf("%lu\n", sizeof(struct dirent));
- DIR* dir = opendir("example_dir/");
- if (dir == NULL) {
- perror("opendir");
- return 1;
- }
- struct dirent* entry;
-
- for (char counter = 0; (entry = readdir(dir)); counter += 1) {
- puts(entry->d_name);
-
-
-
- }
- puts("--- Testing rewind ---");
- rewinddir(dir);
- entry = readdir(dir);
- puts(entry->d_name);
-
-
-
-
-
-
- closedir(dir);
- return 0;
- }
|