]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/filesystem/example/tut2.cpp
bump version to 19.2.0-pve1
[ceph.git] / ceph / src / boost / libs / filesystem / example / tut2.cpp
CommitLineData
7c673cae
FG
1// filesystem tut2.cpp ---------------------------------------------------------------//
2
3// Copyright Beman Dawes 2009
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 <boost/filesystem.hpp>
1e59de90 12
7c673cae
FG
13using namespace std;
14using namespace boost::filesystem;
15
16int main(int argc, char* argv[])
17{
1e59de90
TL
18 if (argc < 2)
19 {
20 cout << "Usage: tut2 path\n";
21 return 1;
22 }
23
24 path p(argv[1]); // avoid repeated path construction below
25
26 if (exists(p)) // does path p actually exist?
27 {
28 if (is_regular_file(p)) // is path p a regular file?
29 cout << p << " size is " << file_size(p) << '\n';
30 else if (is_directory(p)) // is path p a directory?
31 cout << p << " is a directory\n";
32 else
33 cout << p << " exists, but is not a regular file or directory\n";
34 }
7c673cae 35 else
1e59de90 36 cout << p << " does not exist\n";
7c673cae 37
1e59de90 38 return 0;
7c673cae 39}