Re: showing a logfile in a Textview(like tail -f)
- From: tomas tuxteam de
- To: rupert <rupertt gmail com>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: showing a logfile in a Textview(like tail -f)
- Date: Fri, 21 Jul 2006 09:16:31 +0000
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]