Reputation: 2827
If I need to, I suppose I could write my own version using streams, but this seems like a basic piece of functionality which should be out there somewhere.
Upvotes: 0
Views: 472
Reputation: 2827
The boost::filesystem
library contains a copy_file
function. It is documented
at the boost website.
It can be used like this
#include <string>
#include <boost/filesystem.hpp>
std::string sourcePath = "./sourceFile.txt";
std::string destPath = "./destFile.txt";
boost::filesystem::copy_file(sourcePath, destPath, boost::filesystem::copy_option::overwrite_if_exists);
Upvotes: 3
Reputation: 101
2NinerRomeo's post contains an error: it should say overwrite_if_exists whare it says overwrite_if_exitsts
Upvotes: 0