Version française
Home     About     Download     Resources     Contact us    
Browse thread
printf & scanf oddity
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile@s...>
Subject: printf & scanf oddity
Dear All

I find the following quite strange:

% ocaml
        Objective Caml version 3.09.1

# Printf.sprintf "_a%d_f%d" 1 2;;
- : string = "_a1_f2"
# Scanf.sscanf "_a1_f2" "_a%d_f%d" (fun x y -> x,y);;
Exception:
Scanf.Scan_failure
 "scanf: bad input at char number 5: looking for '_', found 'f'".


Is it a bug, or did I misunderstood something?

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France