Boost isn't the only way of scanning directories but it's probably the easiest way to do it in a platform-neutral way - i.e. without using a platform-specific API (such as Win32).
Here's a simple example using boost:
#include <boost/filesystem.hpp>
#include <iostream>
#include <iterator>
#include <set>
std::set<boost::filesystem::path> getDirContents (const std::string& dirName)
{
std::set<boost::filesystem::path> paths;
std::copy
( boost::filesystem::directory_iterator (dirName)
, boost::filesystem::directory_iterator ()
, std::inserter (paths, paths.end ())
);
return paths;
}
int main (int argc, char* argv[])
{
std::set<boost::filesystem::path> paths = getDirContents ("C:\\");
std::copy
( paths.begin ()
, paths.end ()
, std::ostream_iterator<boost::filesystem::path> (std::cout, "\n")
);
return 0;
}