Re: retrieving data from another process



First question already answered by Eric Harlow.
Erik Greenwald wrote:
>My second question; I have to call another program (gcc) and
>get the output (STDOUT and STDERR) into data for my program.
>What would be the best way to approach this? is there a better
>way than to call the program redirecting to a /tmp file, then
>read that? I also need my program to stay functional while
>that runs, but know when the program terminates, is there a
>signal handler?
If you want to get both stdout AND stderr then popen() won't do; I guess
you'll need to fork() and then exec() just after redirecting streams as
desired with pipe()/dup().  You stop reading when you get EOF, no need
for handlers IMHO.
-Daniel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]