This is exactly how i has solved it now but i don't think it is a pretty
way of doing it.
So if i haven't got this all wrong you cant use "gtk_input_add" to check
if a file has more data to read from, or?
- Johan
On Mon, 2002-04-08 at 11:41, Dov Grobgeld wrote:
> Hejsan Johan,
>
> I wasted a lot of time of this as I was sure that there was a way
> of doing select() on a file handle and get notification whenever
> there is something to read on the opened file. It turns out that
> Unix does not support that. (Please prove me wrong! 8-) The only
> way I could get this to work was by polling and each time reading
> to the end of the file. The following code shows the heart of the
> system:
>
> :
> gtk->timeout_add(500, [\&add_text_from_files, $names_and_handles]);
> :
>
> # called whenever there is something to read on the file handle
> sub add_text_from_files {
> for my $fnfh (@$file_names_and_handles) {
> my($fn, $fh, $color_idx) = @$fnfh;
>
> # read till end of file
> while(<$fh>) {
> add_to_text_window($colors[$color_idx], " $_\n");
> }
> }
> :
> }
>
> Hope this helps.
>
> MVH,
> Dov Grobgeld
>
> On Mon, Apr 08, 2002 at 09:50:44AM +0200, Johan Ankarloo wrote:
> > I am working on a firewall gui and this part is about the log part.
> >
> > All logs about this is located into /var/log/messages and i want to
> > receive a notification about when there is more data ready to read from
> > the file. Doing it with tail only ignores the problem and put the
> > problem into tails hand. Perl has to have a way of doing the same thing.
> >
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|