You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
388 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <dirent.h>
  5. #include <sys/stat.h>
  6. int main() {
  7. DIR *d = opendir("/");
  8. if (d == NULL) {
  9. perror("opendir");
  10. exit(1);
  11. }
  12. struct dirent *entry;
  13. while ((entry = readdir(d))!= NULL) {
  14. if (entry->d_name[0] == '.')
  15. continue;
  16. printf("%s ", entry->d_name);
  17. }
  18. }