Seb
Seb

Reputation: 11

How to do EOF in CLion IDE?

I'm trying to do a simple scan line code in CLion:

while((c=getchar())!=EOF) {
        char_count++;
    }

. I learned in class to type Ctrl-D to do a manual EOF, but this doesn't work in CLion. I've looked at previous questions about the same topic, and the command is enabled in the preferences. Any solutions?

Upvotes: 1

Views: 1195

Answers (2)

苏凯承
苏凯承

Reputation: 51

It's a bug in clion, you can run your code in the terminal.

Like this:

  • first: gcc xxx.c (it will create a file named a.out)

  • second: ./a.out (code will run)

  • third: the terminal will receive your EOF signal

My point of view:

It is just a problem in IDE...the code is fine, thinks

Upvotes: 0

Cemal Efe Gayir
Cemal Efe Gayir

Reputation: 13

There is actually a long-known issue about this. Have you tried disabling the option run.processes.with.pty in Registry (Find Action > Registry)?

Upvotes: 0

Related Questions