From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA10660; Wed, 6 Feb 2002 19:15:53 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA11667 for ; Wed, 6 Feb 2002 19:15:52 +0100 (MET) Received: from mel-rto6.wanadoo.fr (smtp-out-6.wanadoo.fr [193.252.19.25]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g16IFqn15210 for ; Wed, 6 Feb 2002 19:15:52 +0100 (MET) Received: from mel-rta2.wanadoo.fr (193.252.19.152) by mel-rto6.wanadoo.fr; 6 Feb 2002 19:15:52 +0100 Received: from debian (80.8.75.115) by mel-rta2.wanadoo.fr; 6 Feb 2002 19:15:40 +0100 Received: from moi by debian with local (Exim 3.34 #1 (Debian)) id 16YWbf-0003J6-00 for ; Wed, 06 Feb 2002 19:15:43 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Ocaml equivalent of python's References: <20020206140335.GA27734@adept.co.za> From: Remi VANICAT Date: 06 Feb 2002 19:15:43 +0100 In-Reply-To: <20020206140335.GA27734@adept.co.za> Message-ID: <87heouschc.dlv@wanadoo.fr> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Johann Spies writes: > I have tried > ------------------------------------------------- > # let listing = Unix.execv "ls -laprt";; > val listing : string array -> unit = > # let l = Array.to_list listing;; > This expression has type string array -> unit but is here used with > type > 'a array > ------------------------------------------------- Unix.execv is a raw interface to the exec unix system call. You should use the "High-level process and redirection management" function : let reading = open_process_in "ls -laprt";; then reading is a in_channel that you can read with the General input functions of the core library. for example if you want the list of the line : let rec list_of_line file_in = try let line = input_line file in in line :: (list_of_line file_in) with | End_of_file -> [] but stream may be more useful than list to manipulate information from a channel (and the Directories function of the Unix library are more useful than this list, if you want to know what is in a directory) -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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