Распечатать содержимое директории

Apr 13, 2011 19:00

Еще один способ распечать рекурсивно содержимое папки. На этот раз через Boost.Filesystem

namespace bf = boost::filesystem;
using namespace std;

void print_folder(LPCWSTR _folderName)
{
bf::recursive_directory_iterator ib(_folderName), ie;
copy(ib, ie, ostream_iterator(cout, "\n"));
}

Трудно сдерживаться, чтобы не писать в одну строчку. Жестокий век узких мониторов :)

std::copy(boost::filesystem::recursive_directory_iterator(_folderName), boost::filesystem::recursive_directory_iterator(), std::ostream_iterator(std::cout, "\n"));

stl, boost, cpp

Previous post Next post
Up