为什么Ctrl+Z在下面的小程序上没有触发循环结束?
#include <stdio.h>
main()
{
int c;
while ((c = getchar()) != EOF)
{
//nothing
}
return 0;
}
如果我输入:test^ZEnter
,它不会跳出循环。
我发现了相关问题(here 和 here),但没有针对 Windows 下的 C(而非 C++)进行解释。
注意:我在 windows 8.1 上使用 Visual Studio 2015 PRE
最佳答案
您需要按 Enter 然后使用 ctrl+Z 然后再次 Enter。
或者,您也可以使用 F6
关于c - 为什么 Ctrl-Z 不触发 EOF?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51579261/