sending EOF to stdin in Clion IDE
Asked Answered
T

4

20

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.

Thrilling answered 4/4, 2016 at 14:33 Comment(5)
In Windows, Ctrl-Z must be the first keystroke after a newline. Don't know about Clion.Fibriform
Did you find your answer by any chance, I found out about this the hard way :( no solution yet.Rely
@Rely I'm afraid not..Thrilling
So the console where the output shows, on linux a CTRL+ D results in a SIGHUP and terminates the program however, if I open the Terminal and run the program it all worksRely
In CLion on MacOS, cmd+D sends EOF and ctrl+D runs the code in Debug.Fjeld
C
14

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).

Ceresin answered 14/9, 2016 at 12:15 Comment(0)
H
6

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

Handout answered 6/8, 2021 at 14:56 Comment(2)
That worked for me aswell, Ubuntu inside VMwareWinther
to clarify, ^ followed by newline works for me (using Debian). For more info, see "Caret notation" on wikipediaJaclynjaco
C
1

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.

Chronograph answered 16/5, 2017 at 15:30 Comment(0)
C
0

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

Coldblooded answered 9/5 at 19:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.