Launch program, then exit (C++)

 
Post new topic   Reply to topic    Aprelium Forum Index -> Off Topic Discussions
View previous topic :: View next topic  
Author Message
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Tue Feb 06, 2007 8:30 pm    Post subject: Launch program, then exit (C++) Reply with quote

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 View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1295

PostPosted: Wed Feb 07, 2007 12:06 am    Post subject: Re: Launch program, then exit (C++) Reply with quote

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 View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Off Topic Discussions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group