0

I'm trying to do debugging c/c++ program in vscode debug tab. Well, after setting some properties which is spread through google, it works well. However, when I try to do debug with program containing "scanf" or "cin" which requires user input, it never receives any input from my keyboard. How can I do so?

And what I found from google is that setting "externalConsole" value as true like this picture.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "g++ - 활성 파일 빌드 및 디버그",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/Sort/test",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": true,
      "MIMode": "lldb",
      "preLaunchTask": "C/C++: g++ build active file"
    }
  ]
}

However, if I change the value of externalConsole as true and try to debug program containing cin, there is no progress after the below picture.

the moment tryting to debug the given program

Even though I try to input the data in the external console(for example "asd"), it says "zsh:command not found asd". How can I fix it for program to receive my input. HELP ME PLZ

1 Answer 1

2
  1. install CodeRunner extension on your VSCode
  2. and then follow steps : Code -> Preferences -> Settings
  3. then on setting type CodeRunner Settings
  4. find the Run In Terminal
  5. Enable that function

Follow these steps and you will be able to run your code on VSCode terminal and it would be possible to enter Input

enable this

Sign up to request clarification or add additional context in comments.

1 Comment

What I ask is not running a program which was already possible but inputting my input while debugging

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.