(I tried to reply to the list, but my messages keep bouncing. I have to look into that.)
On Sun, Dec 19, 2010 at 2:53 PM, AJ ONeal <cool...@gmail.com> wrote:
How do I make a system call without waiting for it to finish?
The normal approach is to use fork() to create the child process and then the appropriate member of the exec*() family of functions to load the appropriate program for the child.If you need to do I/O with the child process, use popen(). It does the fork and exec for you (actually it invokes a shell and has it execute the string you provide), and returns a file handle that represents stdin/stdout of the child process.There are libraries that provide higher-level APIs for starting and managing child processes, but fork(), exec*() and popen() are all POSIX and therefore portable.
--Shawn
+1 for popen(). I've used it a lot and it's _incredibly_ handy.
--
Alex Esplin