Vscode-code-runner: How to input after running?

Created on 11 Mar 2017  ·  9Comments  ·  Source: formulahendry/vscode-code-runner

for example in c++,

cin >> t;

How can I input?

fyi question

Most helpful comment

For input support, please use below setting (File->Preference->Settings) to run code in Integrated Terminal:

{
    "code-runner.runInTerminal": true
}

All 9 comments

For input support, please use below setting (File->Preference->Settings) to run code in Integrated Terminal:

{
    "code-runner.runInTerminal": true
}

The current issue with the extension is that , if I run a program which includes a stdin the output window waits for the input and the only way to terminate it is close the application . Under default settings.

Ideal solution would be include some way to terminate it and also include some GUI button to run the program in terminal .

This is nice, thanks!

for example in c++,

cin >> t;

How can I input?
Two ways:
(1) In setting.json file => add this line-
{
"code-runner.runInTerminal": true
// Other lines...
}
You are done!!
Or
(2) Follow these steps-
Step1. Go to File > Preference > Setting.
Step2. Then on the left panel, scroll and find 'Run Code Configuration'.
Step3. Under that option: keep cursor on "code-runner.runInTerminal" and click on edit icon.
Step4: You will see two true & false option. Make it true.
Step5: You are done!!

"code-runner.runInTerminal": true

👏🏻👏🏻👏🏻

not working in mac.

not working in mac.

it works well on mine mbp

In case you run into issues with a bash error like "bash: cd: too many arguments" then I found this to be a solution in the visual studio code settings for code runner:
"code-runner.executorMap": { "cpp": "g++ $fileName -o $fileNameWithoutExt.exe && './$fileNameWithoutExt.exe'" }

for example in c++,

cin >> t;

How can I input?
Two ways:
(1) In setting.json file => add this line-
{
"code-runner.runInTerminal": true
// Other lines...
}
You are done!!
Or
(2) Follow these steps-
Step1. Go to File > Preference > Setting.
Step2. Then on the left panel, scroll and find 'Run Code Configuration'.
Step3. Under that option: keep cursor on "code-runner.runInTerminal" and click on edit icon.
Step4: You will see two true & false option. Make it true.
Step5: You are done!!

Thanks Dude ^_^

Was this page helpful?
0 / 5 - 0 ratings

Related issues

0x7FFFFFFFFFFFFFFF picture 0x7FFFFFFFFFFFFFFF  ·  3Comments

bhavinkamani picture bhavinkamani  ·  4Comments

rana picture rana  ·  5Comments

eegod picture eegod  ·  5Comments

N2ITN picture N2ITN  ·  5Comments