C++ ifstream getline()
read a line of text
#include <fstream> #include <iostream> using namespace std; int main()// w w w . j a va 2s .c om { const int MAX = 80; //size of buffer char buffer[MAX]; //character buffer ifstream infile("TEST.TXT"); //create file for input while( !infile.eof() ) //until end-of-file { infile.getline(buffer, MAX); //read a line of text cout << buffer << endl; } return 0; }