From: Brian Hurt <bhurt@janestcapital.com>
To: Luca de Alfaro <luca@dealfaro.org>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] commands.getoutput () in ocaml?
Date: Wed, 22 Aug 2007 16:17:24 -0400 [thread overview]
Message-ID: <46CC99D4.30804@janestcapital.com> (raw)
In-Reply-To: <28fa90930708221256t497e8356k84861abd6b2e91b8@mail.gmail.com>
Luca de Alfaro wrote:
> Dear All,
>
> I am looking for a quick way to do the equivalent of
>
> s = commands.getoutput ("ls " + name + "*")
>
> in Ocaml.
>
> Unix.system does perform a call, but the output of the call is not
> returned... yes, I can redirect it to /tmp/output.ocaml and then read
> the file, or even go crazy and build pipes, but is there a more
> elegant (read: succint) way to do it?
>
> Luca
>
If what you want is to spawn a process and redirect the I/O, the
standard library is short on convience functions- in this way Ocaml is
more similiar to C++/Java than it is Perl/Python/Ruby. Although the
convience functions are not that hard to write. If you want to read a
directory, you might want to look at Unix.opendir, Unix.readdir, etc.
Brian
prev parent reply other threads:[~2007-08-22 20:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-22 19:56 Luca de Alfaro
2007-08-22 20:05 ` [Caml-list] " malc
2007-08-22 20:10 ` malc
2007-08-22 20:11 ` Dave Benjamin
2007-08-22 21:32 ` Luca de Alfaro
2007-08-22 22:11 ` Yitzhak Mandelbaum
2007-08-22 22:13 ` Daniel Bünzli
2007-08-22 22:35 ` Olivier Andrieu
2007-08-22 23:04 ` Eric Cooper
2007-08-22 22:52 ` Dave Benjamin
2007-08-23 4:03 ` Dave Benjamin
2007-08-23 17:07 ` Eric Cooper
2007-08-23 15:24 ` Dr. Axel Poigné
2007-08-22 20:17 ` Brian Hurt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46CC99D4.30804@janestcapital.com \
--to=bhurt@janestcapital.com \
--cc=caml-list@yquem.inria.fr \
--cc=luca@dealfaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox