Re: Best way to launch command-line program from C++ application
Re: Best way to launch command-line program from C++ application
- Subject: Re: Best way to launch command-line program from C++ application
- From: Dave Carrigan <email@hidden>
- Date: Fri, 20 Mar 2009 14:08:37 -0700
On Mar 20, 2009, at 1:48 PM, David Gagnon wrote:
So, I tried "exec" but it does
not work, because Acrobat is multi-process.
I believe you mean Acrobat is multi-threaded. In any case, you almost
never want to do an exec without first doing a fork.
system() will do what you want; under the hood, all it's doing is
fork(2), followed by execve(2), followed by waitpid(2). Note that
because system() actually calls the shell, you have to take care that
your command string doesn't have any shell-special characters in it.
That's why I typically prefer to do my own fork/exec/wait.
--
Dave Carrigan
email@hidden
Seattle, WA, USA
Attachment:
PGP.sig
Description: This is a digitally signed message part
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden