FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

How to fetch the list of folders from a given folder?

 


sambhav
How to fetch the list of folders from a given folder in C++?
Indi
There is no way in standard C++ to do this... yet.

However, i recommend Boost.Filesystem. It is simple, sexy, portable and powerful, and will very likely be part of a future standard.

To get the list of folders in a folder using Boost.Filesystem:
Code:
typedef boost::filesystem::path path_type; // to save typing

std::vector<path_type> get_child_folders(path_type const& p)
{
  typedef boost::filesystem::basic_directory_iterator<path_type> iter; // to save typing
 
  std::vector<path_type> folders;
 
  for (iter i = iter(p); i != iter(); ++i)
    if (is_directory(i->status()))
      folders.push_back(*i);
 
  return folders;
}
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.