Ticket #5152: test_path.cpp

File test_path.cpp, 650 bytes (added by lcarreon@…, 12 years ago)
Line 
1#include <iostream>
2#include <boost/filesystem.hpp>
3
4using namespace std;
5using namespace boost::filesystem;
6
7static void gvDisplayPath(const char* apDescription, const char* apPath)
8{
9 path vPath(apPath);
10 vPath.make_preferred();
11
12 cout
13 << apDescription << ":" << endl
14 << endl
15 << " generic_string = \"" << vPath.generic_string() << "\"" << endl
16 << " native = " << vPath.native() << endl;
17
18 cout << endl;
19}
20
21int main()
22{
23 gvDisplayPath("Current directory path", current_path().string().c_str());
24 gvDisplayPath("Parent of current directory path", current_path().remove_filename().string().c_str());
25
26 return 0;
27}