Hi there. If I try to run my code using code runner and if there is any sort of input. For eg : cin in c++ then the output window just freezes and cannot accept any inputs. I then have to manually stop the code runner. I need some ideas to fix this.
Hi @thebigJ007 , you could go to File > Preferences -> User Settings to add setting as below:
{
"code-runner.runInTerminal": true
}
Then you could run C++ in built-in terminal with input support
What is built-in terminal? I can only see output window when running code through code runner...
@shenhui28 It is the built-in terminal: https://code.visualstudio.com/docs/editor/integrated-terminal
If you set "code-runner.runInTerminal", the code will run in built-in terminal. But if the file is untitled or running code snippet of selection, it is still in Output Window.
Thanks formulahendry !!!
For those using the GUI. Press Ctrl + Shift + P, type "User Settings" and select "User settings". Search for "Run in terminal" and check the checkbox for the code runner setting. I strongly believe that this setting should be on by default. Ah, well. I guess the devs know what they are doing
For those using the GUI. Press Ctrl + Shift + P, type "User Settings" and select "User settings". Search for "Run in terminal" and check the checkbox for the code runner setting. I strongly believe that this setting should be on by default. Ah, well. I guess the devs know what they are doing
Thanks a lot!
@peterchaula i cant find "run in terminal"
@theking17082000 I found it in VSC v-1.38. You should scroll down one screen to find it

@peterchaula thanks for your effort but it is different for me. can u tell me a way to disable
gui

ui mode
Thanks a lot Guys ! It worked 馃挴
how can I take an input of my cpp program from a file like "input.txt" rather than giving it in terminal. Does code runner support this?
Thank you guys, i was having this problem for weeks
I wrote a simple program to print hello World. It runs in the output window and the external terminal but fails to do so in the integrated one even though I have enabled Run in Terminal Option , but it stops here :
cd "c:\Users\KIIT\Desktop\CPP\" ; if ($?) { g++ pattern.cpp -o pattern } ; if ($?) { .\pattern }
How to proceed?
I wrote a simple program to print hello World. It runs in the output window and the external terminal but fails to do so in the integrated one even though I have enabled Run in Terminal Option , but it stops here :
cd "c:\Users\KIIT\Desktop\CPP\" ; if ($?) { g++ pattern.cpp -o pattern } ; if ($?) { .\pattern }
Change the default shell from powershell to command prompt and then check the issue if it is resolved or not
I wrote a simple program to print hello World. It runs in the output window and the external terminal but fails to do so in the integrated one even though I have enabled Run in Terminal Option , but it stops here :
cd "c:\Users\KIIT\Desktop\CPP\" ; if ($?) { g++ pattern.cpp -o pattern } ; if ($?) { .\pattern }Change the default shell from powershell to command prompt and then check the issue if it is resolved or not
It started working in powershell all of a sudden, I don't know how. Now how to switch to bash?
Most helpful comment
Hi @thebigJ007 , you could go to
File>Preferences->User Settingsto add setting as below:Then you could run C++ in built-in terminal with input support