Eof

This is a discussion on Eof within the C++ Programming forums, part of the General Programming Boards category; Hello again, it's your friendly neighborhood Chap,
I was curious what are the uses for determining the end of file ...

Eof

Hello again, it's your friendly neighborhood Chap,
I was curious what are the uses for determining the end of file in user input? What practical uses for it are there? Just something that was on my mind...also is cout.put() used often? that's just been on my mind...Thanks yet again! -Chap

As for user input (Im assuming you mean from a console), EOF is just a way to terminate the input. You could just as easily terminate at a newline character, or some other preset value. An example of this can be found at Bjarn's Technical FAQ .

The main problem with using EOF that I can think of is that the windows console is bugged, and doesn't recognize the EOF character (not sure if this have been fixed). On linux, you send EOF to the console using ctrl-D.

>> I was curious what are the uses for determining the end of file in user input? What practical uses for it are there?

it can be quite useful at preventing infinite loops. seriously though, how else would you know when to stop?? if you're referring to EOF with respect to the standard input, often you'll see other methods for determining an 'end of input' condition not normally used with other input streams, but EOF is still just as applicable nonetheless.