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>](<http://en.cppreference.com/w/cpp/filesystem>)
header and using [copy_file](<http://en.cppreference.com/w/cpp/filesystem/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.