Skip to content

Instantly share code, notes, and snippets.

@harsh9539
Created January 28, 2024 18:58
Show Gist options
  • Save harsh9539/1dc0023c88b6c4b2ab85d1b0eb98c71c to your computer and use it in GitHub Desktop.
Save harsh9539/1dc0023c88b6c4b2ab85d1b0eb98c71c to your computer and use it in GitHub Desktop.
tasks.json for cpp input output file configure on windows
Note: It will not work if your default terminal is Powershell. Make it "cmd" then it will work.
To change default terminal : Hit clt+shift+p->write:default terminal->change it to cmd.
{
"version": "2.0.0",
"tasks": [
{
"label": "Compile and run",
"type": "shell",
"command": "",
"args": [
"copy",
"\"${file}\"",
"${workspaceFolder}\\jspwTest.cpp",
"&&",
"g++",
"jspwTest.cpp",
"-o",
"jspwTest",
"&&",
"jspwTest",
"<",
"input.txt",
">",
"output.txt",
"&&",
"del",
"jspwTest.exe",
"&&",
"del",
"jspwTest.cpp"
],
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true,
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment