在stdin中什么被视为EOF? [英] What is considered as EOF in stdin?
本文介绍了在stdin中什么被视为EOF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
即使我不断输入换行符,我的Visual Studio仍在等待输入。
My Visual Studio still awaits input even after I keep entering a newline.
例如:
while ((c = fgetc(stdin)) != EOF)
{
// do something
}
我应该输入什么将EOF发送到Visual Studio?
What should I enter that sends EOF to Visual Studio?
推荐答案
您可以发送 EOF
和 CTRL + D (对于Linux)或 CTRL + Z (对于Windows) )系统。
You can send an EOF
with CTRL+D (for Linux) or CTRL+Z (for Windows) systems.
详细说明一下,当 fgetc()
等待 empty stdin
,此组合键将模拟 EOF
。如果 stdin
不为空,则必须使用两次组合键(一次可以帮助刷新 stdin
,另一个实际发送 EOF
)。
To elaborate, when fgetc()
is waiting for an input from empty stdin
, this key combination will simulate the EOF
. In case, the stdin
is not empty, you have to use the key combination twice (once to help flush the stdin
, another to actually send the EOF
).
这篇关于在stdin中什么被视为EOF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文