Visual Studio Code use input text file on debug

编程总结 | vscode

Posted by 陈陈 on January 14, 2021

If we use the vscode to debug, but the program requires an input file, then it will wait and never reach the break point. For example, we start in shell like

”./a.out 1 test1.txt”

We have to type the arguments in “launch.json” file in the following manner:

“args”: [”<”, “${workspaceFolder}/test1.txt”],

where the ‘${workspaceFolder}’ can be replaced by absolute path like:

/home/songchen/Downloads/sparta-master/examples/