Version française
Home     About     Download     Resources     Contact us    
Browse thread
Buffer.add_channel hangs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stas Miasnikou <stas.miasnikou@g...>
Subject: Buffer.add_channel hangs
Hi,

OCaml 3.11.1, OpenBSD 4.6, i386.

I am trying to read whole file by doing:

let read_file_bin name =
  let ic = open_in_bin name in
  let b = Buffer.create 1024 in
  (try Buffer.add_channel b ic max_int with _ -> ()); (* <-- HERE *)
  close_in ic;
  Array.init (Buffer.length b) (fun i -> int_of_char (Buffer.nth b i))

but it hangs on the line marked. Am I doing something wrong?

Stas