c++ 遍历文件夹函数
来源:互联网 发布:ubuntu内核 编辑:程序博客网 时间:2024/06/18 17:15
void getFilesAll(string path, vector<string>& files) {
//文件句柄
intptr_t hFile = 0;
//文件信息
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) {
do {
if ((fileinfo.attrib & _A_SUBDIR)) {
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) {
//files.push_back(p.assign(path).append("\\").append(fileinfo.name));
getFilesAll(p.assign(path).append("\\").append(fileinfo.name), files);
}
}
else {
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}
//文件句柄
intptr_t hFile = 0;
//文件信息
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) {
do {
if ((fileinfo.attrib & _A_SUBDIR)) {
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) {
//files.push_back(p.assign(path).append("\\").append(fileinfo.name));
getFilesAll(p.assign(path).append("\\").append(fileinfo.name), files);
}
}
else {
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}
阅读全文
0 0
- c++ 遍历文件夹函数
- c遍历文件夹
- C/C++遍历文件夹
- c 遍历文件夹
- C/C++ 遍历文件夹
- C#--遍历文件夹实例
- C/C++遍历文件夹
- c/c++遍历文件夹
- C、 C++遍历文件夹,删除文件夹
- linux下C遍历文件夹
- C语言实现遍历文件夹
- C遍历文件夹下文件
- 如何c语言遍历文件夹
- Linux C 文件夹遍历接口.
- Linux C语言遍历文件夹
- C、C++文件夹文件遍历
- python 遍历文件夹目录,三个函数
- 字符转换函数及其文件夹遍历
- 职场10大潜规则
- 如何解决跨域请求的问题
- ADB 过滤activity 关键字
- CODEVS--1201 最小数和最大数
- 浅谈模板类vector和array
- c++ 遍历文件夹函数
- <% %>,<%= %>与<%! %>的用途
- android 记录笔记
- Java注释、常用分隔符以及标识符命名规则
- Mac OS 安装Qt 编译时提示 running /usr/bin/xcodebuild
- ssh (安全外壳协议)
- OSX app (Mac app) crash 文件分析与定位
- NGUI_的Panel学习_003
- jdbc链接数据库进行简单的操作学习笔记