How to read again after input EOF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<iostream>
using std::cin;
using std::cout;
using std::numeric_limits;
using std::streamsize;
int main()
{
  char c;
  while(cin>>c);
  cin.clear();  //trying to set cin to good state, right ?
  cin.ignore(numeric_limits<streamsize>::max());//how to empty the stream ? 
  cout<<"To here...\n";
  cin>>c;
}

I typed control-d to exit the first while input, but I can not reset the cin
to read input again. Anyone help me, please. Thanks in advance.
If you did that, how would your users ever close your program? control-d is your user's way of telling you "I'm done". Don't ignore it; respect it.
So once input control-d, no input is accepted from the user, right?
Topic archived. No new replies allowed.