View previous topic :: View next topic |
Author |
Message |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Tue Feb 06, 2007 8:30 pm Post subject: Launch program, then exit (C++) |
|
|
I'm writing a small application which should run a program (background.exe) and exit after the program has been launched.
Code: | #include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
system("background.exe");
return EXIT_SUCCESS;
}
|
This is the code I'm currently using. However, this program wont exit after it has started background.exe, leaving the console window open. Is there any way to make the program run background.exe and then exit without waiting for the started program to finnish? |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1295
|
Posted: Wed Feb 07, 2007 12:06 am Post subject: Re: Launch program, then exit (C++) |
|
|
cmxflash,
If you are on Windows, use the spawn() function.Otherwise (on Unix-like systems), use a combination of fork() and exec() calls. _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
|
|