C:如何模拟一个EOF? [英] C : How to simulate an EOF?
本文介绍了C:如何模拟一个EOF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在读K&放大器; R的书和打字从首节的例子中,有几个象这样的例子:
I am currently reading K&R's book and typing in the examples from the first section, and there are a couple of examples such as this:
while((c = getchar()) != EOF) {
//do something
}
我在Windows中测试这些例子,因而从运行编译的exe文件中的 CMD
提示符。
要测试上面的例子中,我怎么模拟 EOF
?也就是说,我基本上怎样才能使循环停止从命令提示符测试例如当?
To test the example above, how do I simulate an EOF
? That is, basically how can I make the loop stop when testing the example from the command prompt?
推荐答案
要输入一个EOF,使用:
To enter an EOF, use:
- ^ Z(<大骨节病>控制骨节病> <大骨节病>以Z 骨节病>)在Windows
- ^ D
在类Unix系统
- ^Z (CtrlZ) in Windows
- ^D on Unix-like systems
这篇关于C:如何模拟一个EOF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文