#include <iostream> #include <fstream> using namespace std; int main () { ofstream of; ifstream inf; string line; of.open ("test.lis", ios::out); of << "Hello world.\n"; of << "another line.\n"; of.close(); inf.open( "test.lis", ios::in); if (inf.is_open()) { while ( inf.good() ) { getline (inf,line); cout << "got " << line << endl; } inf.close(); } return 0; }