]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/filesystem/example/file_size.cpp
1 // file_size program -------------------------------------------------------//
3 // Copyright Beman Dawes, 2004
5 // Use, modification, and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/filesystem for documentation.
11 #include <boost/filesystem/operations.hpp>
14 namespace fs
= boost::filesystem
;
16 int main( int argc
, char* argv
[] )
21 std::cout
<< "Usage: file_size path\n";
25 std::cout
<< "sizeof(intmax_t) is " << sizeof(boost::intmax_t) << '\n';
27 fs::path
p( argv
[1] );
29 if ( !fs::exists( p
) )
31 std::cout
<< "not found: " << argv
[1] << std::endl
;
35 if ( !fs::is_regular( p
) )
37 std::cout
<< "not a regular file: " << argv
[1] << std::endl
;
41 std::cout
<< "size of " << argv
[1] << " is " << fs::file_size( p
)