Re: piping a apps output to program



On Sat, 15 Jun 2002 00:53:05 -0700 (PDT)
me ok <mjaz_the_mighty2 yahoo com> wrote:

hello,

I am trying to figure out how I would open a pipe to a
program so that I can get it's output.  I'm not too
familiar with C or inter-process communications.  

I want it when the user clicks a button the program
I'm creating will run another program and capture it's
output into a variable, but I'm not sure How that
would be done.

Use popen(3) allows you to launch a program and receive it's output. This is
limited to Unix-like systems I guess. Therefore Glib 2.0 has
g_spawn_async_with_pipes which allows two-way communication with the started
program.

Using gtk_input_add_full makes gtk+ call a function that you supply when input
is available on the file descriptor you give it. Do not read from the file in a
self-made loop, or you'll stop the flow of events in your application and make
it "freeze".

Roland
-- 
R.F. Smith                           /"\    ASCII Ribbon Campaign
r s m i t h @ x s 4 a l l . n l      \ /    No HTML/RTF in email
http://www.xs4all.nl/~rsmith/         X     No Word docs in email
                                     / \    Respect for open standards

Attachment: pgp3HE4MmESvg.pgp
Description: PGP signature



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