1 | #include <iostream> |
---|
2 | #include "boost/filesystem.hpp" |
---|
3 | |
---|
4 | namespace bfs = boost::filesystem; |
---|
5 | |
---|
6 | // clang++ -std=c++11 -g -o ./test_filesystem.clang.macport_boost -I/opt/local/include test_filesystem.cc -L/opt/local/lib -lboost_filesystem-mt -lboost_system-mt |
---|
7 | // g++ -std=c++11 -g -o ./test_filesystem.gcc.macport_boost -I/opt/local/include test_filesystem.cc -L/opt/local/lib -lboost_filesystem-mt -lboost_system-mt |
---|
8 | int |
---|
9 | main (int argc, const char** argv) |
---|
10 | { |
---|
11 | std::cout << "\nThe file '" << argv[1] << "' "; |
---|
12 | bfs::path p (argv[1]); |
---|
13 | |
---|
14 | if (bfs::exists (p)) |
---|
15 | { |
---|
16 | std::cout << "exists!" << std::endl; |
---|
17 | } |
---|
18 | else |
---|
19 | { |
---|
20 | std::cout << "DOES NOT exist." << std::endl; |
---|
21 | } |
---|
22 | |
---|
23 | std::cout << std::endl; |
---|
24 | |
---|
25 | return 0; |
---|
26 | } |
---|