使用boost filesystem递归遍历文件夹

来源:互联网 发布:淘宝说在衣服质检 编辑:程序博客网 时间:2024/05/22 01:46

使用boost filesystem遍历文件夹的时候,需要先进行一些配置:




包含的头文件:(这一部分不太明白,总之这样程序可以正常运行,先记下来)

<span style="font-size:14px;">#define BOOST_ALL_NO_LIB#include <boost/progress.hpp>#include <boost/filesystem.hpp>#include <boost/foreach.hpp>#include <boost/assign.hpp>#include <boost/xpressive/xpressive_dynamic.hpp>#include <boost/algorithm/string_regex.hpp>#include <libs/filesystem/src/codecvt_error_category.cpp>#include <libs/filesystem/src/operations.cpp>#include <libs/filesystem/src/path_traits.cpp>#include <libs/filesystem/src/path.cpp>#include <libs/filesystem/src/portability.cpp>#include <libs/filesystem/src/unique_path.cpp>#include <libs/filesystem/src/utf8_codecvt_facet.cpp>#include <libs/filesystem/src/windows_file_codecvt.cpp>#include <libs/system/src/error_code.cpp></span>

代码:(这是我读取文件夹下图片的的代码)

<span style="font-size:14px;">1.directory_iterator end;2.3.for(directory_iterator pos("E:\\Project\\sourceimage"); pos != end; ++pos)4.{5.directory_entry directoryEntry = *pos;6.string imgPath;7.imgPath = directoryEntry.path().string();8.}</span>


0 0
原创粉丝点击