Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 507
Ptarala99 Avatar asked Oct 20 '25 13:10

Ptarala99


1 Answers

{
     "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.

like image 80
Hiro Avatar answered Oct 23 '25 04:10

Hiro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!