#include #include #include #include int main(int argc, char ** argv) { DIR * dir = NULL; dir = opendir(argv[1]); struct dirent * entry; if(dir==NULL) { printf("error opening directory\n"); exit(1); } while((entry = readdir(dir))!=NULL) { printf("%s\n",entry->d_name); } if(closedir(dir) !=0) { printf("error closing directory\n"); exit(2); } return 0; }