#include <iostream.h> #include <fstream.h> #include <stdlib.h> int main () { char buffer[256]; ifstream examplefile ("test.txt"); if (! examplefile.is_open()) { cout << "Error opening file"; exit (1); } while (! examplefile.eof() ) { examplefile.getline (buffer,100); cout << buffer << endl; } return 0; }
This is a line. This is another line.