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

Function main

example/tut2.cpp:16–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace boost::filesystem;
15
16int main(int argc, char* argv[])
17{
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 }
35 else
36 cout << p << " does not exist\n";
37
38 return 0;
39}

Callers

nothing calls this directly

Calls 4

existsFunction · 0.50
is_regular_fileFunction · 0.50
file_sizeFunction · 0.50
is_directoryFunction · 0.50

Tested by

no test coverage detected