From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Shin-Cheng Mu <scmu@iis.sinica.edu.tw>, caml-list@inria.fr
Subject: Re: Opening a file for both reading and writing
Date: Thu, 18 Feb 1999 22:06:01 +0100 [thread overview]
Message-ID: <19990218220601.20802@pauillac.inria.fr> (raw)
In-Reply-To: <36C2AA353A1.0693SCMU@iis.sinica.edu.tw>; from Shin-Cheng Mu on Thu, Feb 11, 1999 at 06:00:21PM +0800
> Is it allowed to open a file for both reading and writing?
Yes, but you must be careful about calling flush at the right times.
> I opened the same file for reading and writing in 2 seperate
> channels. Some anomalies happened, e.g. reading from a position
> after overwriting some old data doesn't get the newly written
> value.
Probably you didn't call flush on the output channel to save buffered
writes to the disk file. Just remember to flush each time you switch
from "write" mode to "read" mode, and you should be relatively safe.
Regards,
- Xavier Leroy
prev parent reply other threads:[~1999-02-19 8:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-11 10:00 Shin-Cheng Mu
1999-02-18 21:06 ` Xavier Leroy [this message]
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=19990218220601.20802@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=scmu@iis.sinica.edu.tw \
/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