]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/filesystem/example/tut2.cpp
1 // filesystem tut2.cpp ---------------------------------------------------------------//
3 // Copyright Beman Dawes 2009
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
8 // Library home page: http://www.boost.org/libs/filesystem
11 #include <boost/filesystem.hpp>
13 using namespace boost::filesystem
;
15 int main(int argc
, char* argv
[])
19 cout
<< "Usage: tut2 path\n";
23 path
p(argv
[1]); // avoid repeated path construction below
25 if (exists(p
)) // does path p actually exist?
27 if (is_regular_file(p
)) // is path p a regular file?
28 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";
34 cout
<< p
<< " exists, but is not a regular file or directory\n";
37 cout
<< p
<< " does not exist\n";