📄 show_files.c
字号:
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
int my_readir(const char * path)
{
DIR * dir;
struct dirent * ptr;
if ((dir = opendir(path)) == NULL) {
perror("opendir");
return -1;
}
while ((ptr = readdir(dir))!=NULL) {
printf("file name: %s\n",ptr->d_name);
}
closedir(dir);
return 0;
}
int main(int argc, char ** argv)
{
if (argc < 2) {
printf("listfile <target path>\n");
exit(1);
}
if (my_readir(argv[1]) < 0) {
exit(1);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -