1 Star 1 Fork 0

20181217Cindy / cindy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ls2.c 608 Bytes
一键复制 编辑 原始数据 按行查看 历史
20181217Cindy 提交于 2020-11-10 10:41 . ls和ls-l代码
#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>
void myls(char []);
int main(int ac,char * av[]){
if (ac == 1) {
myls(".");
} else {
while (--ac) {
++av;
myls(*av);
}
}
return 0;
}
void myls(char dirname[]){
DIR *dir_ptr;
struct dirent *direntp;
if ((dir_ptr = opendir(dirname)) == NULL) {
fprintf(stderr, "ls1 cannot open %s\n",dirname);
} else {
while ((direntp = readdir(dir_ptr)) != NULL)
printf("%s ", direntp->d_name);
printf("\n");
closedir(dir_ptr);
}
}
C
1
https://gitee.com/csq200215/csq.git
git@gitee.com:csq200215/csq.git
csq200215
csq
cindy
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891