Copying from istream never stops

Posted by the_drow on Stack Overflow See other posts from Stack Overflow or by the_drow
Published on 2010-05-09T00:55:51Z Indexed on 2010/05/09 0:58 UTC
Read the original article Hit count: 196

Filed under:
|
|

This bit of code runs infinitely:

copy(istream_iterator<char>(cin), istream_iterator<char>(), back_inserter(buff));

The behavior I was expecting is that it will stop when I press enter.
However it doesn't.
buff is a vector of chars.

© Stack Overflow or respective owner

Related posts about c++

Related posts about istream