Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::ifstream

 

std::ifstream is an STL file input stream.

 

 

 

 

 

Example: CopyFile

 

#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();
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict