Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] select (or polling) on in_channel?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: sejourne kevin <sejourne_kevin@y...>
Subject: Re: [Caml-list] select (or polling) on in_channel?
 --- Eijiro Sumii <eijiro_sumii@anet.ne.jp> a écrit : 
> P.S.  I've also received an e-mail informing me that
> Cash
> 
>   http://pauillac.inria.fr/cash/latest/doc/Cash.html
> 
> has such a function.  It looks nice, but having it
> in pure/core OCaml
> would be even nicer.
> 
> From: "Eijiro Sumii" <eijiro_sumii@anet.ne.jp>
> > Thanks to everyone for ideas on how to "select"
> Pervasives.in_channel.
> > Since there seems to be no better solution than
> > 
> >   (1) hacking the low-level structure by using
> external C, or
> > 
> >   (2) reinventing the high-level library on top of
> Unix I/O,
> > 
> > I'm thinking of submitting a feature wish at
> > http://pauillac.inria.fr/bin/caml-bugs.  It should
> be easy enough for
> > the developers to implement, I hope...  (I could
> contribute my own
> > implementation if necessary, but I'm sure they
> will do better work.)
I'not sure of what you want, but does this do the job?
let système command f_line = 
  let cin = Unix.open_process_in command
  in 
    (try while true do
      f_line (input_line cin);
    done with | End_of_file -> ());
  Unix.close_process_in cin
;;
It is just a function that give to 'f_line' evry 
lines produced by a pipe by the 'command'.

I use it for Xdialog2Ocaml

Kevin.


	

	
		
__________________________________________________________________
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/