List Info

Thread: "ocaml_beginners"::[] reading/writing binary data




"ocaml_beginners"::[] reading/writing binary data
user name
2006-11-21 13:17:37

On Tuesday 21 November 2006 12:05, drehman27 wrote:
> but OCaml only has 31 bit signed ints.

No. Look at Int32, Int64 and Big_int, for example.

> Why doesn't OCaml read back data in the same format?

RTFM:

val output_binary_int : out_channel -> int -> unit
(** Write one integer in binary format (4 bytes, big-endian)
on the given output channel.
The given integer is taken modulo 2{^32}.
The only reliable way to read it back is through the
{!Pervasives.input_binary_int} function. The format is compatible across
all machines for a given version of Objective Caml. *)

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )