Commits

Vladimir Brankov committed 1e96060

Add command to open file.

  • Participants
  • Parent commits b4a7b3f

Comments (0)

Files changed (4)

   Printf.printf "%d\n" status;
   let file_id = H5f.create "SampleFile.h5" [ H5f.Acc.EXCL ] in
   let status = H5f.close file_id in
+  Printf.printf "%d\n" status;
+  let file_id = H5f.open_ "SampleFile.h5" [ H5f.Acc.RDONLY ] in
+  let status = H5f.close file_id in
   Printf.printf "%d\n" status
 external close : t -> int = "caml_h5f_close"
 external create : string -> ?fcpl_id:H5p.t -> ?fapl_id:H5p.t -> Acc.t list -> t
   = "caml_h5f_create"
+external open_ : string -> ?fapl_id:H5p.t -> Acc.t list -> t = "caml_h5f_open"
 
 val close : t -> int
 val create : string -> ?fcpl_id:H5p.t -> ?fapl_id:H5p.t -> Acc.t list -> t
+val open_ : string -> ?fapl_id:H5p.t -> Acc.t list -> t
 
   CAMLreturn(alloc_h5f(H5Fcreate(name, flags, fcpl_id, fapl_id)));
 }
+
+value caml_h5f_open(value name_v, value fapl_id_v, value flags_v)
+{
+  CAMLparam3(name_v, fapl_id_v, flags_v);
+
+  const char* name = String_val(name_v);
+  unsigned flags = acc_val(flags_v);
+  hid_t fapl_id = H5P_opt_val(fapl_id_v);
+
+  CAMLreturn(alloc_h5f(H5Fopen(name, flags, fapl_id)));
+}
+
+