Question:
How do you get C++ to run an outside program? How do you type this in the source code?
Answer:
You can invoke another executable from your programming by calling the system() function (defined in
For example, if you have an executable called “calculator.exe” and you want to run this program from your application:
#includeint main(){ system("calculator.exe");}
Many platforms have other functions that launch a program, e.g., execvp(). However, system() is portable because it’s defined by the ANSI C and C++ standards.