How to Appropriately Start Another Application from My GUI Application

I would like to know the appropriate method for starting another program from my GUI application and then kill it later while not losing control of my GUI. I want to be able to do something similar to below that doesn't freeze the GUI:

void on_buttonStartExternalProgram_clicked()
{
     //procedure to start program
}

void on_buttonStopExternalProgram_clicked()
{
     //procedure to stop external program
}

I just need to start an external program I don't need to pass data between it.
thomas1477Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fridomCEO/ProgrammerCommented:
Depends on the system you are using and what "goals" you have.
If you just have to start a program you can use
system
assuming you speak about C, which is abolutly not clear BTW

On Unices you may or may not want to use
- popen
- fork/execxxx stuff

Now if it should not "freeze" you system you have to check what the proper options for calling out are.

So if you like to get a better answer I suggest you tell us
- which languages you're using
- what OS you have

Friedrich
fridomCEO/ProgrammerCommented:
Oh, great I havn't realized we are in the Linux section so the things which hold and
work
are
-system
- popen
- fork/exec

A good book about programming Unices is "Advanced Programming in the UNIX Environment" from W. Richard Stevens, your stuff looks to me like it is GTK+
So you may make good use of:
http://developer.gnome.org/doc/API/2.0/glib/glib-Spawning-Processes.html

Regards
Friedrich

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thomas1477Author Commented:
I've looked at those with the exception of popen. What about threads? I haven't tried it yet but can you start another application using the create thread method or combination of thread and exec like fork/exec?
fridomCEO/ProgrammerCommented:
A thread is not a process, so it is a different thing, You wrote you want to start another application that's a process for me. If something like starting a indpendent process is a possible from threads is beyond my knowledge.

Regards
Friedrich
thomas1477Author Commented:
Yeah, that makes sense. Ok thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.