(C++) boost::filesystem::copy\_file
January 30, 2018 · View on GitHub
(C++) boost::filesystem::copy_file
boost::filesystem::copy_file is a Boost.Filesystem file I/O function to copy a file.
#include <cassert> #include <boost/filesystem.hpp> int main() { const std::string from = "from.txt"; const std::string to = "to.txt"; assert(boost::filesystem::is_regular_file(from) && "Assume file is present"); boost::filesystem::copy_file(from,to); }
Note for Qt Creator users
Add the following line to your project file (to prevent the link error undefined reference to 'boost::system::get_system_category()'):
LIBS += -lboost_system -lboost_filesystem