Guest User

Untitled

a guest
Feb 19th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <dirent.h>
  3. #include <sys/types.h>
  4.  
  5. static void list_dir(const char *path)
  6. {
  7. struct dirent *entry;
  8. DIR *dir = opendir(path);
  9. if (dir == NULL) {
  10. return;
  11. }
  12.  
  13. while ((entry = readdir(dir)) != NULL) {
  14. printf("%s\n",entry->d_name);
  15. }
  16.  
  17. closedir(dir);
  18. }
Add Comment
Please, Sign In to add comment