12.5.1.Open a file for input and read in its content
#include <fstream>
#include <iostream> using namespace std;
int main ()
{ char buffer[256];
fstream myfile;
// open it for input and read in
myfile.open("test.txt",ios::in);
myfile.getline(buffer,100);
cout << "The file contains " << buffer << "\n";
myfile.close();