For no good reason other than I just used this code once again, and once again marvelled at the almost script-like qualities STL-laden C++ has, here is the easy recipe for reading each line of a text file into a string (assume correct includes and using namespace std).
ifstream infile( "/etc/hosts" );
while( getline( infile, line ) )
cout << line << endl;
Yes, it’s rudimentary.