title: How do you know when an input stream has reached the last word in a line?
body: <p>I'm reading input from an ifstream in C++. The input comes as a bunch of words separated by tabs, so I'm reading in something like "word1 word2 word3" as stream >> w1 >> w2 >> w3; I need to know when I've reached the final word in the line, so how would I go about that? The number of words is variable, but it should be always even. Also, will the last word contain the \n, or will the \n be the last word?</p>