EOF assistance

Can someone explain to me what EOF is? And how it works?

EOF is short for End Of File. It works by being at the end of a stream. They call it EOF instead of EOS out of tradition.

By the way, never loop until EOF - it's wrong ;)
I still don't understand. So it stands for End of File..so what does it do then lol

This is how im picturing it

// code
code code code code
code code
//

End of the file

so the point of this is indicate whether or not the code is at the end of the program?
"File" in this case refers to some external data file being accessed by your program. More broadly, it applies to a stream, of which a file is just one example. cin and cout are also examples of streams, and there are others too.

But the main thing is, as a beginner, you almost never need to use eof, so now you heard of it, the next thing to do is to put it to the back of your mind and forget about it.
Topic archived. No new replies allowed.