Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sending EOF to stdin in Clion IDE

Tags:

c

clion

Is there a way to send EOF to stdin when running a c program in Clion IDE? I tried ctrl+D - it simply shuts the program down. Ctrl+Z doesn't work either. Any ideas?

BTW - I'm using it on a Windows 10 OS.

like image 201
noamgot Avatar asked Apr 04 '16 14:04

noamgot


People also ask

How to end input in CLion?

Ctrl+D terminate program after closing input pipe when run in CLion.

How do you send an EOF signal?

eof is not a signal but is implemented by the tty driver as a read of length 0 when you type ctrl-d .


3 Answers

ctrl+D does the job, however there is a known problem, to avoid it disable option run.processes.with.pty in Registry (Find Action > Registry).

like image 101
nastasiak2512 Avatar answered Oct 27 '22 01:10

nastasiak2512


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

like image 44
InsertaRandomNameNow Avatar answered Oct 27 '22 01:10

InsertaRandomNameNow


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.

like image 27
Zvika Avatar answered Oct 27 '22 00:10

Zvika