Maybe you should not write directly to that file. Instead you can send the text/record to a server application which is responsible in writing that text. The server application can refuse writing requests OR it can receive all data and keep it in a buffer until the file is 'free'.
just an idea... Ross Levis wrote: > Yes I realize that, but I only want the file not writable by another PC > while a record is being written. When I'm finished writing a record, > which may take a few milliseconds, I want others to be able to write to > the file immediately afterwards. > > If an attempt to write to the file fails, it needs to wait in a loop > until the file is writable again. > > So is opening and closing the file in different modes the only way to do > this? > > I'm thinking back a few years to when I use to program in Dataflex for > DOS. It was multi-user but not client/server. It had a Lock and > Unlock command which you could set just before and after a SaveRecord > operation to a file. I don't think it actually closed and opened the > file everytime the Lock and Unlock was performed, but I may be wrong. > It seemed a lot faster than that. There were updates of thousands of > records with a Lock and Unlock used for each record and it was very > quick. > > Any further ideas? > > Thanks, > Ross. > > ----- Original Message ----- > From: "Wilfried Mestdagh" <[EMAIL PROTECTED]> > To: "Borland's Delphi Discussion List" <[email protected]> > Sent: Monday, March 19, 2007 12:57 AM > Subject: Re: File locking > > > Hello Ross, > > You can open the file with fmOpenReadWrite or fmShareDenyWrite. then > others cannot write to the file. > > --- > Rgds, Wilfried > http://www.mestdagh.biz > > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi > > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi > > _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

