I'm wanting the program to read a line out of file. I wish c++ had .eoln()!
I get: test.cpp:10: no match for `std::ifstream& != char' operator
obviously because I'm comparing the wrong data types.
#include <iostream>
#include <fstream>
using namespace std;int main ()
{
ifstream infile("test_file.txt");while(infile!='\n' && !infile.eof())
cout<<infile;return 0;
}
Is there a function in c++, like in pascal, so you can detect the end of a line? I know in pascal it would be like infile.eoln(), but that doesn't work in c++.
Any help will be appreciated,
Thanks
Andy