What is cin's streambuffer's state and content after the following
(using namespace std)?
string((istream buf_iterator<ch ar>(cin)),
istreambuf_iter ator<char>()) );
I am trying to use this in a loop (to get a 'multiple cat'-like
behavior) and the second time around it returns an empty string
instead of waiting for more input. This makes me think that either the
end-of-stream stays in the buffer or cin or its buffer is in some bad
state. Either way, how can this be fixed to get more input?
Thanks,
S.
(using namespace std)?
string((istream buf_iterator<ch ar>(cin)),
istreambuf_iter ator<char>()) );
I am trying to use this in a loop (to get a 'multiple cat'-like
behavior) and the second time around it returns an empty string
instead of waiting for more input. This makes me think that either the
end-of-stream stays in the buffer or cin or its buffer is in some bad
state. Either way, how can this be fixed to get more input?
Thanks,
S.
Comment