mydir.h
来自「设计并实现一个多用户多级目录结构的文件系统。该系统必须具备下列功能:目录操作」· C头文件 代码 · 共 35 行
H
35 行
#include<sys/types.h>#include<dirent.h>#include<unistd.h>void mydir(char * str){ if(strcmp(str,"")==0) { char buf[80]; getcwd(buf,sizeof(buf)); DIR* dir; struct dirent *ptr; int i; dir=opendir(buf); while((ptr=readdir(dir))!=NULL) printf("%s\n",ptr->d_name); closedir(dir); } else { DIR* dir; struct dirent *ptr; int i; if((dir=opendir(str))!=NULL) { while((ptr=readdir(dir))!=NULL) printf("%s\n",ptr->d_name); closedir(dir); } else printf("There is not such file directory!\n"); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?