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

Function main

example/tut2.cpp:15–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace boost::filesystem;
14
15int main(int argc, char* argv[])
16{
17 if (argc < 2)
18 {
19 cout << "Usage: tut2 path\n";
20 return 1;
21 }
22
23 path p (argv[1]); // p reads clearer than argv[1] in the following code
24
25 if (exists(p)) // does p actually exist?
26 {
27 if (is_regular_file(p)) // is p a regular file?
28 cout << p << " size is " << file_size(p) << '\n';
29
30 else if (is_directory(p)) // is p a directory?
31 cout << p << " is a directory\n";
32
33 else
34 cout << p << " exists, but is neither a regular file nor a directory\n";
35 }
36 else
37 cout << p << " does not exist\n";
38
39 return 0;
40}

Callers

nothing calls this directly

Calls 4

existsFunction · 0.85
is_regular_fileFunction · 0.85
file_sizeFunction · 0.85
is_directoryFunction · 0.85

Tested by

no test coverage detected