From: Karl Zilles <zilles@1969.ws>
To: yjc01@doc.ic.ac.uk
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] open_file
Date: Tue, 25 Jan 2005 14:54:02 -0800 [thread overview]
Message-ID: <41F6CE0A.1010301@1969.ws> (raw)
In-Reply-To: <1106691570.41f6c5f250fdc@www.doc.ic.ac.uk>
yjc01@doc.ic.ac.uk wrote:
> The code I came up with is as follows:
I forgot to add, there is no reason to use a reference for buff:
>
> open Unix;;
>
> let file_reader = openfile "sudent.cd" [O_RDONLY] 0o640;;
> let buff = ref "empty";;
let buff = "empty";;
>
> let main () =
> let file_content = read file_reader !buff 1 5 in
let file_content = read file_reader buff 0 5 in
> print_int file_content;
> print_string !buff;;
print_string buff;;
> main ();
This is because you are actually writing directly on the string, so
there is no need for indirection.
next prev parent reply other threads:[~2005-01-25 22:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-25 22:19 open_file yjc01
2005-01-25 22:43 ` [Caml-list] open_file Karl Zilles
2005-01-25 22:58 ` Oliver Bandel
2005-01-26 14:41 ` [Caml-list] read file Yan Jun Daisy Chen
2005-01-26 15:50 ` Oliver Bandel
2005-01-25 22:54 ` Karl Zilles [this message]
2005-01-26 10:16 ` [Caml-list] open_file Marcin 'Qrczak' Kowalczyk
2005-01-25 22:54 ` Oliver Bandel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41F6CE0A.1010301@1969.ws \
--to=zilles@1969.ws \
--cc=caml-list@yquem.inria.fr \
--cc=yjc01@doc.ic.ac.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox