/[cparse]/cparse/dir-test.c
ViewVC logotype

Contents of /cparse/dir-test.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Mon Nov 29 20:22:56 2004 UTC (9 years, 4 months ago) by clynbech
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +7 -5 lines
File MIME type: text/plain
modified to print all entries
1 clynbech 1.1 #include <sys/types.h>
2     #include <dirent.h>
3    
4     main() {
5     DIR *handle;
6     struct dirent *entry;
7 clynbech 1.2 int x = 0;
8 clynbech 1.1
9 clynbech 1.2 printf("DIRTEST/c\n");
10     handle = opendir("/tmp");
11     entry = (struct dirent *)1;
12     while (handle && entry) {
13 clynbech 1.1 entry = readdir(handle);
14     if (entry)
15 clynbech 1.2 printf("%d: %s\n", x++, entry->d_name);
16 clynbech 1.1 }
17 clynbech 1.2 closedir(handle);
18 clynbech 1.1 }
19    

  ViewVC Help
Powered by ViewVC 1.1.5