简体   繁体   English

istream_iterator eos

[英]istream_iterator eos

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. 我想知道是否可以在控制台中放置一些东西,如果以这种方式编码,它将终止输入过程。

您可以通过在Windows上按CTRL-Z或在Linux上按CTRL-D,将EOF从终端发送到标准输入流。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM