打开目录、读取目录里面的内容 opendir readdir
来源:互联网 发布:金蝶软件优缺点 编辑:程序博客网 时间:2024/06/01 10:47
#include<stdio.h>#include <dirent.h>#include<stdlib.h>//打开目录//读取目录里面的内容//DIR *opendir(const char *name);//struct dirent *readdir(DIR *dirp);#if 0struct dirent { ino_t d_ino; /* inode number */ off_t d_off; /* offset to the next dirent */ unsigned short d_reclen; /* length of this record */ unsigned char d_type; /* type of file; not supported by all file system types */ char d_name[256]; /* filename 需要*/ };#endifint main(int argc,char *argv[]){ DIR *dp; dp = opendir(argv[1]); if(dp == NULL) { perror("opendir failed"); exit(1); } struct dirent *dir; while((dir = readdir(dp)) != NULL) //!= { printf("%s\n",dir->d_name); } return 0;}/*$ ./a.out test...test1test1.ctest2test2.c*/
阅读全文
0 0
- 打开目录、读取目录里面的内容 opendir readdir
- opendir() readdir()目录流
- opendir 、closedir 、readdir 目录函数
- php读取目录文件函数is_dir(),opendir(),readdir(),closedir()
- perl中目录句柄的操作(opendir, readdir, closedir)
- Linux C/C++ ----目录文件的操作(opendir,readdir,closedir)
- is_dir(),opendir(),readdir()简单遍历目录下的文件
- linux c下目录文件的操作(opendir,readdir,closedir)
- Linux目录操作函数:opendir/readdir/closedir
- 获取目录信息opendir/readdir/closedir
- opendir----打开目录函数
- 读取目录readdir
- Linux中读取目录: opendir,fdopendir,readdir,rewinddir,closedir,telldir,seekdir
- opendir---opendir() 函数打开目录句柄。
- linux c学习笔记----目录文件的操作(opendir,readdir,closedir)
- linux 目录操作函数opendir readdir closedir,文件stat
- linux C 遍历目录及其子目录 opendir -> readdir -> closedir
- 4.21 opendir、readdir和closedir函数-读目录
- C++读写txt文件(基本操作1)
- Ubuntu 14.04 LTS Apache2 开启 SSI 功能
- C++ 11 多线程 (一)
- LightOJ
- 取当前进程对应之静态映像文件的绝对路径/proc/self/exe
- 打开目录、读取目录里面的内容 opendir readdir
- 软件调试笔记27
- .net System.Web.Mail发送邮件 (已过时)
- android.view.View android.view.View.findViewById(int)' on a null object reference
- msql用分表优化2亿数据查询速度
- JS
- XYLIO Future.DJ Pro(专业dj混音软件)官方注册版V1.5.2下载 | Future.DJ破解版 | Future.DJ注册机
- layer弹出层关闭后刷新父页面
- linux 安装vsftpd