Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <dirent.h>
- #include <string.h>
- int main(int argc, char **argv)
- {
- DIR *dir;
- struct dirent *dp;
- char filename[NAME_MAX];
- if ( argc < 2 )
- strcpy(filename, ".");
- else
- strcpy(filename, argv[1]);
- if ( !(dir=opendir(filename)) )
- return 1;
- while( (dp=readdir(dir)) != NULL )
- printf("%s\n", dp->d_name);
- closedir(dir);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement