C++ examples for boost:file system
Combining paths with Boost
#include <iostream> #include <string> #include <cstdlib> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/fstream.hpp> using namespace std; using namespace boost::filesystem; int main(int argc, char** argv) { try { // Compose a path from the two args path p1 = complete(path("c:/abc/def", native), path("xyz", native)); cout << p1.string() << endl; path p2 = system_complete(path(argv[2], native)); cout << p2.string() << endl; } catch (exception& e) { cerr << e.what() << endl; } return(EXIT_SUCCESS); }