# VSCode C/C++ File Input + Output (Code Runner) Three Way View from [this video](https://www.youtube.com/watch?v=EAR7De6Goz4) ## 0. Download Code Runner extension for VSCode ## 0.5 Open Settings in VSCode (Cmd + , ), go to `Code-runner: Executor Map`, then open settings.json ## 1. Add these two lines in settings.json of the .vscode/ folder in the directory of your .cpp file. ```json "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && ./$fileNameWithoutExt < input.txt > output.txt", "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && ./$fileNameWithoutExt < input.txt > output.txt" ``` ## 2. Place files input.txt ← program reads from this output.txt ← program writes to this (auto-created) Both go in the same folder as your .c/.cpp file. ## 3. Run / Stop Run code (while focused on the .cpp file): Ctrl + Option + N Terminate code: Ctrl + Option + M ## 4. After running Open output.txt to see all program output.