Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I call a c++ exe file from c++?

Status
Not open for further replies.

tgel76

Programmer
Jul 2, 2001
17
0
0
GB
Hi, I'm using Borland c++ 5.02, and I'm a new user. In my program I want to call another c++ program that i didn't have its code. Actually I used Matlab to C++ converter (in Matlab 6) and i have only the filename.exe. Is it possible and how?
 
look into the "system" call

system(executable name);

Matt
 
thanks matt,
but could you be more specific?
 
The following is an example of using the system function.
Code:
#include <stdlib.h> // needed for system call
#include <stdio.h>

int main(void)
{
   printf(&quot;About to spawn command.com and run a DOS command\n&quot;);
   system(&quot;filename.exe&quot;); // put the program you want to call in here
   return 0;
}
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Thanks a lot James P. Cottingham
it works...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top