C++ File I/O Copying a file


std::ifstream  src("source_filename", std::ios::binary);
std::ofstream  dst("dest_filename",   std::ios::binary);
dst << src.rdbuf();

With C++17 the standard way to copy a file is including the <filesystem> header and using copy_file:

std::fileystem::copy_file("source_filename", "dest_filename");

The filesystem library was originally developed as boost.filesystem and finally merged to ISO C++ as of C++17.