Scott Barron wrote:

>         I am writing a graphical front end to a third party program.  The
> program often puts out a lot of data to stdout and/or sterr.  I am looking for
> an efficient way to capture this data so that I may display it in my GUI
> program.  What is the suggested method of doing this?  Thanks for any help.

The most straightforward way of obtaining the output of a subprocess
is to run it via popen(). The subprocess will inherit stdin from the
parent. If you need to provide both the stdin and stdout/stderr
streams, then you'll need to do it manually with pipe, fork, dup2 and
exec (in that order). More details available on request (preferably to
the list).

If this is an X front end, then you would use XtAppAddInput to
register an event handler to be called when a descriptor is available
for read/write (in spite of the name, XtAppAddInput applies to both
input and output descriptors).

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to