Re: gdk_input_add



"Dugas, Alan" wrote:
> 
> Currently I'm trying to read a file that gets updated asynchronously.
> gtk_timeout_add() seems to cause racing conditions.  gdk_input_add() locks
> up my cpu.  Does anyone have a method for asynchonously reading a file that
> works?
> 
>                                 -- Stupid Genius
> P.S.
> I've seen some messages regarding gdk_input_add() which advise against using
> it to monitor a file (i.e. it will always have data for reading, etc).  Can
> anyone comment on this?

Well the following appears to do what you want, if you are typing it at
a shell:

tail --follow --lines=+0  /path/to/file/your/watching

so you could always do the popen( cmd, "r" ) thing to leverage off
an existing solution. I just posted a code snipet on another thread,
i.e.

Re: OT: capturing stdout & stderr to a GtkText

to do exactly that. Be sure to read the restrictions though.

-- 
We stand on the shoulders of those giants who coded before.
Build a good layer, stand strong, and prepare for the next wave.
Guide those who come after you, give them your shoulder, lend them your code.
Code well and live!   - gmd slip net (7th Coding Battalion)




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