I'm working on Stroustrups's Programming & Principles book and came up with a question I haven't been able to solve via Google.
Will cin ever flip the istream's EOF bit?
My guess is that it won't because cin doesn't read from a file (we use ifstream for that).
The question arose while writing a >> operator for a simple struct that holds two doubles. I use the >> operator to read from console and a file, so I needed to handle both situations. Reading from a file flips EOF correctly, but I'm not sure if cin will ever flip it and lead to a problem.
that's input redirection. Whenever in your program you read from the standard input stream (like cin), you'll be actually reading from the `input' file.
When `input' ends, cin would reach eof.