Back to index

glibc  2.9
dir.c
Go to the documentation of this file.
00001 /*@group*/
00002 #include <stdio.h>
00003 #include <sys/types.h>
00004 #include <dirent.h>
00005 /*@end group*/
00006 
00007 int
00008 main (void)
00009 {
00010   DIR *dp;
00011   struct dirent *ep;
00012 
00013   dp = opendir ("./");
00014   if (dp != NULL)
00015     {
00016       while (ep = readdir (dp))
00017        puts (ep->d_name);
00018       (void) closedir (dp);
00019     }
00020   else
00021     perror ("Couldn't open the directory");
00022 
00023   return 0;
00024 }