Ticket #48026: test_filesystem.cc

File test_filesystem.cc, 710 bytes (added by chris.jonesey@…, 9 years ago)
Line 
1#include <iostream>
2#include "boost/filesystem.hpp"
3 
4namespace 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
8int
9main (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}