From: "Nicolas Cannasse" <warplayer@free.fr>
To: "Diego Olivier Fernandez Pons" <Diego.FERNANDEZ_PONS@etu.upmc.fr>,
<caml-list@inria.fr>
Subject: Re: [Caml-list] Pervasives 'general output functions'
Date: Fri, 29 Oct 2004 19:12:44 +0900 [thread overview]
Message-ID: <001701c4bd9f$d68bc370$0b05a8c0@PWARP> (raw)
In-Reply-To: <Pine.A41.4.44.0410291115470.1798336-100000@ibm1>
> Bonjour,
>
> I would like a Caml program to output some information to an output
> channel and according to my needs this channel be redirected to
> - a (human readable) file
> - the standard output
> - a black hole
>
> The "general output functions" section of Pervasives seem to be what I
> need but it hasn't the same signature than "Output functions on
> standard output"
Generic IO from ExtLib are dealing with this problem, and have a printf
functionnality.
They also have useful functions such as write_i16 / write_ui32 .... (in low
and big endian) when dealing with C binary files.
> I suspect I could just compose with string_of_X functions to obtain
> the same result. There is also an awful [fprintf] function inherided
> from C but I am still trying to understand the doc (never understood
> C's either).
printf "%d %f %s %c" 33 1.234 "hello" 'x'
> Why haven't the equivalent functions been added to the standard lib to
> allow a drop in replacement ?
Maybe because printf allows you to specify precision for int/floats as well
as newlines ?
Nicolas
prev parent reply other threads:[~2004-10-29 10:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-29 9:40 Diego Olivier Fernandez Pons
2004-10-29 10:12 ` Nicolas Cannasse [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='001701c4bd9f$d68bc370$0b05a8c0@PWARP' \
--to=warplayer@free.fr \
--cc=Diego.FERNANDEZ_PONS@etu.upmc.fr \
--cc=caml-list@inria.fr \
/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