English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Format and str_formatter
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-09-11 (11:27)
From: Christian Sternagel <christian.sternagel@u...>
Subject: Format and str_formatter
Hi there,

Recently I started to use the Format module's support for custom tags 
(in order to print XML). I noticed a somehow strange behavior (at least 
it seems strange to me). What follows is a minimal example:

First enable tag printing via

   # Format.set_tags true;;
   - : unit = ()

Now consider the printing function

   # let f fmt = Format.fprintf fmt "@{<test>test@}";;
   val f : Format.formatter -> unit = <fun>

When used on std_formatter it produces what I expected, namely

   # f Format.std_formatter;;
   <test>test</test>- : unit = ()

On str_formatter however the result is different.

   # f Format.str_formatter;;
   - : unit = ()
   # Format.flush_str_formatter();;
   - : string = "test"

Where have my tags gone? What am I missing here?

thnx for any help