0
Can anybody say what does this mean while(! File. eof())
5 Answers
+ 6
The not operator is used to run the loop only till the EOF is not encountered.
If we don't see EOF, it means we have more data in the file to be read. So we continue reading.
You see, file.eof() returns true when EOF is read.
+ 5
It just checks whether we have reached the End-Of-File(EOF) character in a file or not.
The EOF character is used to mark the end of a text/binary file. All I/O must stop after this, thus we use eof().
+ 4
Yes, thats it. You have understood it.
+ 3
eof returns false until end of the file is detected, so to make the condition of while loop correct not operator is used to run the loop.... Did i get it right?
+ 2
Thank you for your answer. But what is the use of not operator '!' it can be simply written as while(file.eof())