]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/filesystem/example/tut6b.cpp
buildsys: change download over to reef release
[ceph.git] / ceph / src / boost / libs / filesystem / example / tut6b.cpp
CommitLineData
7c673cae
FG
1// filesystem tut6b.cpp --------------------------------------------------------------//
2
3// Copyright Beman Dawes 2010
4
5// Distributed under the Boost Software License, Version 1.0.
6// See http://www.boost.org/LICENSE_1_0.txt
7
8// Library home page: http://www.boost.org/libs/filesystem
9
10#include <iostream>
11#include <exception>
12#include <boost/filesystem.hpp>
13using namespace boost::filesystem;
14
15int main(int argc, char* argv[])
16{
17 if (argc < 2)
18 {
19 std::cout << "Usage: tut6b path\n";
20 return 1;
21 }
22
23 try
24 {
25 for (recursive_directory_iterator it (argv[1]);
26 it != recursive_directory_iterator();
27 )
28 {
29 for (int i = 0; i <= it.level(); ++i)
30 std::cout << " ";
31
32 std::cout << it->path() << '\n';
33
34 try { ++it; }
35 catch (const filesystem_error& ex)
36 {
37 std::cout << "************* filesystem_error *****************\n";
38 std::cout << ex.what() << '\n';
39 }
40 }
41 }
42
43 catch (const std::exception& ex)
44 {
45 std::cout << "************* exception *****************\n";
46 std::cout << ex.what() << '\n';
47 }
48
49 return 0;
50}