On Thu, Jul 20, 2006 at 07:27:44PM +0200, rupert wrote:
[...]
> works great

Glad I could help :-)

[...]

> thx for your help, again

you're welcome

>             while(  (got = fread(buf, 1, sizeof(buf), fp))  >  0  )

There is one snag here. Fread doesn't distinguish whether there is an
EOF condition in the input or just zero bytes read. So it is important
to read in "blocking mode" (which is the default anyway). The
disadvantage is, of course that if the popened program hangs for a while
so will the graphical application. The alternatives I see are (a)
decoupling via a temp file (as your original approach suggested) or (b)
opening in non-blocking mode and handling zero-byte-reads more carefully
(with select() or actually the glib wrappers for this
g_io_channel_xxx()).

Regards
-- tomas
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to