Re: g_coprocess()




Sascha Ziemann <szi@aibon.ping.de> writes:

> Hi,
> 
> does anybody have a function that forks a Gtk+ program and starts a
> child program in order to write to the child and read it's output.

KanjiPad (http://www.gtk.org/~otaylor/kanjipad/) does this.

(The important function is init_engine() in kanjipad.c)

There may be some things it doesn't do quite right (For one
thing, since the child is supposed to last as long as the
parent, it doesn't bother to wait() for the child. If the
child exited before the parent, then you'd get a zombie),
but it should get you started.

The main thing to watch out for is to use _exit() instead
of exit() in the child, so the child doesn't try to clean
up the parent's X connection.

Regards,
                                        Owen



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