Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Unix.create_process
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Francois Pottier <francois.pottier@i...>
Subject: Re: [Caml-list] Unix.create_process

Hi Rolf,

You need to create a pipe, have the process write into one end of it, and read
data off the other end. The function [Unix.open_process_in] does that for
you. Here is an example:

  let one_liner command =
    let channel = Unix.open_process_in command in
    let line = input_line channel in
    let _ = Unix.close_process_in channel in
    line
  ;;

-- 
François Pottier
Francois.Pottier@inria.fr
http://pauillac.inria.fr/~fpottier/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr