C++ examples for boost:file system
Copying a file with Boost
#include <iostream> #include <string> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/fstream.hpp> using namespace std; using namespace boost::filesystem; int main(int argc, char** argv) { try { path src = complete(path("main.cpp", native)); path dst = complete(path("target.cpp", native)); copy_file(src, dst); } catch (exception& e) { cerr << e.what() << endl; } return(EXIT_SUCCESS); }