- #include <stdio.h>
- #include <dirent.h>
- void main(int argc, char *argv[])
- {
- DIR *directory_pointer;
- struct dirent *entry;
- if ((directory_pointer = opendir(argv[1])) == NULL)
- printf("Error opening %sn", argv[1]);
- else
- {
- while (entry = readdir(directory_pointer))
- printf("%sn", entry);
- closedir(directory_pointer);
- }
- }