Q:

What triggers an End of File?

I'm pretty new to programming, and recently, my class started file handling using C++. My question is what triggers an end of file? Just like there is "\n" for a new line character, is there something specific that the compiler looks at to know if it is eof? An answer with lots of juicy details is much appreciated!

A:

End Of File (EOF) isn't tied to a specific character like End Of Line (EOL / LF) is. It's simply a state to signal "we're at the end of this file", different methods will have different way of signalling this. Usually this EOF "state" is triggered when the code tries to read past the end of the file. 
For example, when using an ifstream, the get() method will return Traits::eof() if we've read all the data in the file. After that point, calling std::ifstream::eof() will return true. This only applies to C++'s streams though, different methods and/or languages may have different ways of signalling EOF, it's not a universal thing like EOL is, there's no character to describe EOF.

