Don't crash when dependencies are missing
[glibc.git] / manual / examples / dir.c
blob8ab77dc34c3c2e9b77bd3b25a61e03d52419a546
1 /*@group*/
2 #include <stdio.h>
3 #include <sys/types.h>
4 #include <dirent.h>
5 /*@end group*/
7 int
8 main (void)
10 DIR *dp;
11 struct dirent *ep;
13 dp = opendir ("./");
14 if (dp != NULL)
16 while (ep = readdir (dp))
17 puts (ep->d_name);
18 (void) closedir (dp);
20 else
21 perror ("Couldn't open the directory");
23 return 0;