Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
The Unix module & records
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-05-12 (17:12)
From: Amit Dubey <adubey@h...>
Subject: The Unix module & records


	I'm still in the process of learning caml, but I'm considering
using it for a project that I'm working on.  One of the first things
I need to do is to figure out how to load a file!  I've tried the following

1: let main () =
2:        let file_info : Unix.stats = Unix.stat Sys.argv.(1) in
3:        let fd = Unix.openfile Sys.argv.(1) [ Unix.O_RDONLY ] perm in
4:        let buffer = ref "" in
5:        let bytes_read = (fd) (buffer) (file_info.st_size) in

But it fails with the error "Unbound record field label st_size" on line 5.
I can't explain why this is happening; looking at the file, I see
the st_size field in the Unix.stats record.  Any suggestions would be

Amit Dubey