Let's say I have a C/C++ file named userfile.c
.
Using Python, how can I invoke the local gcc compiler so that the file is compiled and an executable is made? More specifically, I would like to provide some input (stdin) via some file input.txt
and I want to save the standard output into another file called output.txt
. I saw some documentation that I will need to use subprocess, but I'm not sure how to call that and how to provide custom input.