Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Pervasives 'general output functions'
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-10-29 (09:43)
From: Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@e...>
Subject: Pervasives 'general output functions'

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"

print_char    ->  output_char
print_string  ->  output_string
print_int     ->  ?
print_float   ->  ?
print_endline ->  ?
print_newline ->  ?

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).

Why haven't the equivalent functions been added to the standard lib to
allow a drop in replacement ?

        Diego Olivier