我们如何终止本C code吗? [英] How do we terminate this C code?

查看:157
本文介绍了我们如何终止本C code吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本C code是K&安培; R。这是持续运行,甚至当我键入-1。我使用Eclipse在什么是错与此code的Fedora 17?它将如何终结?即使CTRL + D无法正常工作结束了!

 #包括LT&;&stdio.h中GT;
INT主要(无效)
{
    INT℃;    C =的getchar();
    而(C!= EOF)
    {
        的putchar(C);
        C =的getchar();
    }    返回0;
}


解决方案

  

这是持续运行,即使当我输入-1


在Unix平台上,你需要输入Ctrl-D而不是到文件末尾。


由于鸣叫鸭指出,<一个href=\"http://stackoverflow.com/questions/4711098/passing-end-of-transmission-ctrl-d-character-in-eclipse-cdt-console\">this似乎是在Eclipse 的错误。

This c code is from K&R. It is running continuously, even when I type -1. I am using eclipse in fedora 17. whats wrong with this code? how would it terminate? Even CTRL+D not working to end it!

#include<stdio.h>
int main(void)
{
    int c;

    c = getchar();
    while(c != EOF)
    {
        putchar(c);
        c = getchar();
    }

    return 0;
}

解决方案

It is running continuously, even when I type -1

On Unix you need to type Ctrl-D instead to signal end of file.


As Mooing Duck points out, this seems to be a bug in Eclipse.

这篇关于我们如何终止本C code吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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