c++11 - how to get file names vs directory names in c++ (using boost filesystem library) -


when use boost::filesystem list of file names in directory, receive file names directory names:

#include <string> #include <iostream> #include <boost/filesystem.hpp> using namespace std; using namespace boost::filesystem;  int main() {     path p("d:/anyfolder");     (auto = directory_iterator(p); != directory_iterator(); i++)     {         cout << i->path().filename().string() << endl;     } } 

output like:

file1.txt file2.dat folder1 //which folder 

is there quick way distinguish between files , folders? os windows 8.1, if matters.

is_directory()

boost::filesystem::is_directory(i->path()); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -