Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  #include <stdio.h>
  2.   #include <stdlib.h>
  3.   #include <sys/types.h>
  4.   #include <dirent.h>
  5.   #include <error.h>
  6.  
  7.   int main()
  8.   {
  9.           DIR *dir;
  10.           struct dirent *ent;
  11.           dir = opendir ("./");
  12.           if (dir != NULL) {
  13.  
  14.                   /* print all the files and directories within directory */
  15.                   while ((ent = readdir (dir)) != NULL) {
  16.                           printf ("%s\n", ent->d_name);
  17.                   }
  18.                   closedir (dir);
  19.           } else {
  20.                   /* could not open directory */
  21.                   perror ("");
  22.                   return EXIT_FAILURE;
  23.           }
  24.   }