UNIX环境高级编程_第三版中文版.pdf
#include rourhdr. hr int main(int argc, char *argv []) DIR struct dirent f (argc 2 err quit("a single argument (the directory name )is required"); if ((dp opendir(argv[1]))== NULL err sys("can't open s", argv[1])i while( (dirp readdir(dp))!=NULL printf("%s\n", dirp->d name)i closedir(dp)i exit(0); Include ourhdr h" tdefine BUFFSIZE 8192 int main(void) int char buf [BUFFSIZe]; while( (n= read (STDIN FIleNO buf, BUFFSIZE))>0) f (write(sTDOUT FILENo, buf, n)!= n err sys("write error") if (n
暂无评论