Date: Thu, 18 Feb 1999 22:06:01 +0100
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Shin-Cheng Mu <firstname.lastname@example.org>, email@example.com
Subject: Re: Opening a file for both reading and writing
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
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.
- Xavier Leroy
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:20 MET