尺寸以下功能读取目录和插入的文件名(的push_back())为载体检查文件从当前目录
#include <dirent.h>
void open(string path){
DIR* dir;
dirent *pdir;
dir = opendir(path.c_str());
while (pdir = readdir(dir)){
vectorForResults.push_back(pdir->d_name);
}
}
问题:使用靴库如何检查每个文件的大小(从当前directiory) ?
我找到方法上http://en.highscore.de/cpp/boost/filesystem.html
描述它例如为:
boost::filesystem::path p("C:\\Windows\\win.ini");
std::cout << boost::filesystem::file_size(p) << std::endl;
可能有人请帮助如何实现提升它在我的open()函数?特别是如何将当前目录路径名称分配给变量p,然后遍历文件名称。
要是有某种[参考](http://www.boost.org/doc/libs /1_56_0/libs/filesystem/doc/reference.html)... – user657267 2014-10-19 11:43:15
boost :: filesystem :: path p(path.c_str())但没有成功... – 2014-10-19 11:43:46
[Printing off \ _t file size from dirent struct](http://stackoverflow.com/questions/20528616/打印-t-file-size-from-dirent-struct) – usr2564301 2014-10-19 11:47:38