List Info

Thread: "ocaml_beginners"::[] help with map_file




"ocaml_beginners"::[] help with map_file
user name
2006-11-20 21:32:40

The following code gives me an error message:
Fatal error: exception Sys_error("Bad file descriptor")

movies_file is a binary file that I created with my program. It
contains 32 bit integers (type int).
I tried using dims = -1 but I get a "Permission denied" error.

What is wrong with this code?
Thanks

let data =
let fd = Unix.openfile movies_file [Unix.O_RDONLY] 0o444 in
let kind = Bigarray.int in
let dims = (Unix.fstat fd).Unix.st_size in
Bigarray.Array1.map_file fd kind Bigarray.c_layout true dims

__._,_.___
.

__,_._,___
[1]

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