Ptarala99
Ptarala99

Reputation: 53

How can I add command line arguments in VS Code for C?

I want to know where to put command line arguments in VS Code for C. I know in Visual studio you can hit the project and add the command line arguments, but I do not know how to do that in VS Code.

Upvotes: 4

Views: 22755

Answers (1)

Hiro
Hiro

Reputation: 139

{
     "name": "C Launch",
     "request": "launch",
     "program": "${workspaceFolder}/a.out",
     "args": ["arg1", "arg2"],
     "cwd": "${workspaceFolder}"
}

put the above line in the .vscode/launch.json file in your working directory. Be sure to replace a.out with your name of program. For further details check here.

Upvotes: 8

Related Questions