Update.
[glibc.git] / manual / examples / dir.c
blobb90f72da031b7184d46bb51d80c4467c611bf0f9
1 /*@group*/
2 #include <stddef.h>
3 #include <stdio.h>
4 #include <sys/types.h>
5 #include <dirent.h>
6 /*@end group*/
8 int
9 main (void)
11 DIR *dp;
12 struct dirent *ep;
14 dp = opendir ("./");
15 if (dp != NULL)
17 while (ep = readdir (dp))
18 puts (ep->d_name);
19 (void) closedir (dp);
21 else
22 puts ("Couldn't open the directory.");
24 return 0;