Vscode-code-runner: Codes with any form of input do not run on code runner

Created on 2 Feb 2017  路  15Comments  路  Source: formulahendry/vscode-code-runner

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.

fyi question

Most helpful comment

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

All 15 comments

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

image

@peterchaula thanks for your effort but it is different for me. can u tell me a way to disable
gui
Screenshot (5)
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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rana picture rana  路  5Comments

rickmed picture rickmed  路  4Comments

nmchgx picture nmchgx  路  3Comments

ElektroStudios picture ElektroStudios  路  4Comments

seiferthan picture seiferthan  路  4Comments