如何在终端中输入EOF的值 [英] How to enter the value of EOF in the terminal

查看:47
本文介绍了如何在终端中输入EOF的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C程序.

int main ()
{
    if (getchar()!=EOF)
        puts("Got a character");
    else
        puts("EOF");
}

我应该在终端上的stdin中键入什么才能产生EOF?

What should I type into the stdin on the terminal to produce an EOF?

推荐答案

在Windows中, Control + Z 是表示文件结尾"的典型键盘快捷方式,在Linux和Unix中通常是 Control + D .

In Windows, Control+Z is the typical keyboard shortcut to mean "end of file", in Linux and Unix it's typically Control+D.

这篇关于如何在终端中输入EOF的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆