noamgot
noamgot

Reputation: 4091

How can I send EOF to STDIN in CLion IDE?

Is there a way to send EOF to stdin when running a C program in the CLion IDE?

I have tried Ctrl + D — it simply shuts the program down. Ctrl + Z doesn't work either. Any ideas?

I'm using Windows 10.

Upvotes: 20

Views: 18984

Answers (4)

nastasiak2512
nastasiak2512

Reputation: 1937

Ctrl + D does the job, however there is a known problem.

To avoid it, disable option run.processes.with.pty in Registry (Help → Find Action → Registry).

Upvotes: 15

Martin
Martin

Reputation: 1

An easy fix which worked for me was to go to "Run"->"Edit Configurations" and check "Run in external console".

Upvotes: 0

InsertaRandomNameNow
InsertaRandomNameNow

Reputation: 63

Type in ^ on a newline, in the console after your input, I found it does the trick.

Upvotes: 6

Zvika
Zvika

Reputation: 1702

Another option is to run the program from command line, and attach to it from CLion. In that case, you'll have your native shell.

It's detailed at https://blog.jetbrains.com/clion/2016/01/attach-to-local-process/

The process is very simple - after running the program from command line, choose Run->Attach to Local Process...

And choose your program from the list. You can type in the search field.

Upvotes: 1

Related Questions