I want to read all lines from a file, line by line with a fstream
variable.
For example:
#include <fstream>
fstream fsFile;
fsfile.open("file.txt", ios::in);
while (fsFile.getline(szLine, LINE_SIZE + 1))
{
cout << szLine << endl;
}
When I want to read all the lines but I got a line that is bigger than LINE_SIZE
the fsFile.bad()
returns true and I get it.
But, I want to know how is it that fsFile.getline(szLine, LINE_SIZE + 1)
suddenly returns false
?
I mean what is the return value of the function?
If its null
and I think it is why is it null
?
And when it is not null
what it returns?
Thank you for your support.