Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Amit Dubey <adubey@h...>
Subject: The Unix module & records

	Hi,

	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
code:

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 = Unix.read (fd) (buffer) (file_info.st_size) in
	<snipped>

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 Unix.ml file, I see
the st_size field in the Unix.stats record.  Any suggestions would be
appreciated.

Thanks,
Amit Dubey