[Updated version of my last post] I have situation where i have to read all the files from the directory and to get their size. I have some approach in my mind.I only interested in file name and size of the each individual file. What would be the best approach to get these two values.Thank you
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/range/iterator_range.hpp>
#include <fstream>
#include <string>
int main(){
std::string SourceFolder="C:\\testFolder\\";
boost::system::error_code ec;
path mDirectory(SourceFolder);
std::cout<<"Directory includes the following files"
if(is_directory(mDirectory)){
for(auto testFile=mDirectory.begin();testFile!=mDirectory.end();testFile++){
std::cout<< testFile->string()<<std::endl; // output?
std::cout<< testFile<<std::endl; // output ?
std::cout<< testFile->size()<<std::endl; // output ?
std::cout<<file_size(mDirectory,ec); //output ?
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire