The Unix module & records

From: Amit Dubey (adubey@hopper.math.uwaterloo.ca)
Date: Fri May 12 2000 - 18:55:01 MET DST

  • Next message: Jean-Christophe Filliatre: "Re: 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



    This archive was generated by hypermail 2b29 : Fri May 12 2000 - 19:18:25 MET DST