MCPcopy Create free account
hub / github.com/boostorg/filesystem / main

Function main

example/file_size.cpp:16–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace fs = boost::filesystem;
15
16int main( int argc, char* argv[] )
17{
18
19 if ( argc != 2 )
20 {
21 std::cout << "Usage: file_size path\n";
22 return 1;
23 }
24
25 std::cout << "sizeof(intmax_t) is " << sizeof(boost::intmax_t) << '\n';
26
27 fs::path p( argv[1] );
28
29 if ( !fs::exists( p ) )
30 {
31 std::cout << "not found: " << argv[1] << std::endl;
32 return 1;
33 }
34
35 if ( !fs::is_regular( p ) )
36 {
37 std::cout << "not a regular file: " << argv[1] << std::endl;
38 return 1;
39 }
40
41 std::cout << "size of " << argv[1] << " is " << fs::file_size( p )
42 << std::endl;
43 return 0;
44}

Callers

nothing calls this directly

Calls 3

existsFunction · 0.85
is_regularFunction · 0.85
file_sizeFunction · 0.85

Tested by

no test coverage detected