I am reading input from standard input using cin. I want to be able to read in newlines. The problem is that sometimes there is other stuff in the cin buffer that may have been left over. I dont want to read this in. Is there anyway that I can flush out the cin buffer to be sure that there is nothing in it. I thought that maybe I could use peek to see if there is something there and if there is then read it. But it doesnt seem to be working. I am using something like the following:
Can someone help me with this?
if(cin.peek() != EOF)