Browse thread
open_file
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-01-25 (22:19) |
From: | yjc01@d... |
Subject: | open_file |
I tried to read in a text file and extract the string between (* and *) into a variable, buff, by using the openfile and read functions in Unix module. But get an error on compilation. The code I came up with is as follows: open Unix;; let file_reader = openfile "sudent.cd" [O_RDONLY] 0o640;; let buff = ref "empty";; let main () = let file_content = read file_reader !buff 1 5 in print_int file_content; print_string !buff;; main (); I couldn't work out what went wrong. Can anyone help?!! Daisy