On 10/17/06, Jacques Garrigue wrote: > > From: Tom > > > val Pervasives.input_binary_int : in_channel -> int > > This will indeed read a 32-bit integer, but on a 32-bit architecture > ocaml int's are 31-bit, so you loose the highest bit. > Note that on a 64-bit architecture this is sufficient for 32-bit > integers! > > > val Pervasives.read_int : unit -> int > > This one reads a string... > > > val Marshal.from_channel : in_channel -> 'a > > And this one reads a marshalled value, which must include a special > header indicating its ocaml representation. > > So if you really need to read a full 32-bit integer, none of these > will work, and you must do the job by hand. > > Jacques Garrigue Thanks to everybody. I found a library called extlib which provides a module called IO. I solved the problem with let l = Int32.float_of_bits (IO.read_real_i32 input) BTW, I am a bit surprised the standard library does not offer a way to do that. A simple task can become frustrating. Bye Maurizio