win10 下 c++遍历文件夹
来源:互联网 发布:淘宝编辑图片软件 编辑:程序博客网 时间:2024/06/13 23:25
主要使用#include <io.h>库下的函数
如果 路劲句柄定义为long类型,_findnext函数会报 访问异常,解决方法参考:http://blog.csdn.net/kelvin_yan/article/details/53997840
实例代码:
#include <fstream>#include <string>#include "utils.h"#include <stdio.h>#include <direct.h>#include <iostream>#include <io.h>using namespace std;using namespace cv;string trainPtah = "F://vido and images fro test//UIUC texture database";void getClassName(string path, vector<string>& paths){intptr_t hFile = 0;struct _finddata_t fileinfo;string p;hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo);if (hFile != -1) {while (_findnext(hFile, &fileinfo) == 0) {if (fileinfo.attrib & _A_SUBDIR) {if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) {paths.push_back(p.assign(path).append("/").append(fileinfo.name));//保存文件夹名字}}}}}void main(){vector<string> paths;getClassName(trainPtah, paths);for (int i = 0; i < paths.size(); i++) {cout << paths.at(i) << endl;}system("pause");}
阅读全文
0 0
- win10 下 c++遍历文件夹
- linux下C遍历文件夹
- Linux c 遍历文件夹下的文件名
- Win10-更改c盘下的用户文件夹名
- Win10下C++代码文件夹遍历错误:0xC0000005: 写入位置时发生访问冲突。
- c遍历文件夹
- C/C++遍历文件夹
- c 遍历文件夹
- C/C++ 遍历文件夹
- C#--遍历文件夹实例
- C/C++遍历文件夹
- c/c++遍历文件夹
- C++下遍历文件夹
- C++下 遍历文件夹
- linux 下遍历文件夹
- C++下遍历文件夹
- C++下遍历文件夹
- C++下遍历文件夹
- VS中添加预处理宏的方法
- 4种PHP异步执行的常用方式
- FastJSON、Gson和Jackson性能对比和共同缺点,注意事项
- 蓝桥杯练习----入门训练 圆的面积
- main-bower-files <gulp插件>
- win10 下 c++遍历文件夹
- React native Model组件的使用
- File类
- PHP设计模式之装饰模式
- 用eclipse在maven里面下jar
- Xcode快捷键编辑
- ros kinect设备 gmapping 出现"No matching device found" 错误
- 2017noip总结
- 我的博客即将入驻“云栖社区”,诚邀技术同仁一同入驻。