Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
std::ifstream is an STL file input stream.
#include <cassert> #include <fstream> //From http://www.richelbilderbeek.nl/CppCopyFile.htm void CopyFile(const std::string& fileNameFrom, const std::string& fileNameTo) { assert(FileExists(fileNameFrom)); std::ifstream in (fileNameFrom.c_str()); std::ofstream out(fileNameTo.c_str()); out << in.rdbuf(); out.close(); in.close(); }