> #include <sys/types.h>
> #include <dirent.h>
> #include <stdio.h>
> #include <stdlib.h> int main(int argc,char* argv[]) { DIR *dir; struct dirent *dirp; if(argc !=2) { fprintf(stderr,"usage: %s
> dir_name\n",argv[0]);}
> if((dir=opendir(argv[1]))==NULL)
> {fprintf(stderr,"can't open %s \n",argv[1]);}
> while((dirp=readdir(dir))!=NULL)
> {printf("%s\n",dirp->d_name);}
> closedir(dir); return 0; }
unix 标准输入读写
最新推荐文章于 2021-03-19 21:00:42 发布