Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

istream_iterator eos

Tags:

c++

iterator

cin

Is there any way to end writing to the console, terminate the writing and continue program, if you code the input as

std::istream_iterator<std::string> ii(std::cin);
std::istream_iterator<std::string> eos;
std::for_each(ii,eos,record);

I wonder if you can put something in the console that will terminate the input process if it is coded this way.

like image 504
4pie0 Avatar asked May 25 '26 16:05

4pie0


1 Answers

You can send an EOF to the standard input stream from the terminal by pressing CTRL-Z on Windows or CTRL-D on Linux.

like image 184
Blastfurnace Avatar answered May 28 '26 04:05

Blastfurnace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!