Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: Beginner
Feb 29, 2000



Application Security Testing: An Integral Part of DevOps

Running an External Program

How do you get C++ to run an outside program? How do you type this in the source code?

You can invoke another executable from your programming by calling the system() function (defined in ). System() takes a const char * that is the name of an .exe or .bat file and passes it to the shell command, which in turn, invokes that program.

For example, if you have an executable called "calculator.exe" and you want to run this program from your application:

int main()

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.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date