Re: [gtk-list] Re: retrieving data from another process



>>>>> "ds" == Daniel Solaz <dsolaz@sistelcom.com>
>>>>> wrote the following on Tue, 21 Jul 1998 17:30:26 +0200

ds> First question already answered by Eric Harlow.
ds> 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?
ds> If you want to get both stdout AND stderr then popen() won't do; I guess
ds> you'll need to fork() and then exec() just after redirecting streams as
ds> desired with pipe()/dup().  You stop reading when you get EOF, no need
ds> for handlers IMHO.
ds> -Daniel

f = popen("cmd 2>&1", "r");

redirects stdin and stdout.


ds> -- 
ds> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



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