Running another .exe file in my program

Hello people

I have a small question regarding running a .exe file from my program is possible ?
For ex : My main program is main.exe in C:\Test folder
Like after taking the user's input for ex: If user presses (1) - run 1.exe which is located in the same working directory (C:\Test). Is it possible to do that ?

NOTE: Both main.exe and 1.exe are console progams
Last edited on
Well, the simplest and ugliest way to do this would be to use system("1.exe").
The proper way to do this is by calling OS function CreateProcess().

http://msdn.microsoft.com/en-us/library/ms682425.aspx
Err why do you say that system() is the ugliest way and CreateProcess() the proper ? Explain ? And also which header file should i inlude so as to access both of those functions ?
cstslib for one and windows.h for the other.

http://www.cplusplus.com/forum/beginner/1988/
Topic archived. No new replies allowed.