Article View: borland.public.cppbuilder.nativeapi
Article #2423read/write semiphores?
From: Robert G. Hoover
Date: Fri, 02 Mar 2007 03:20
Date: Fri, 02 Mar 2007 03:20
17 lines
1720 bytes
1720 bytes
Hi, What's the best way to guard against one program writing to a file when another program is reading the same file? In my app, I use TStringList::LoadFromFile() to read in the contents of a particular file. I manipulate the contents to my liking and then save the file back to the disk using TStringList::SaveToFile(). In another app, I also read in the contents of the same file, append additional contents to it, and then save the amended file to the disk under the same name. I need to make sure that no additions are lost because it happens at just the wrong time after my first app reads the file but before my first app saves the revised file. I'm pretty sure I can use a marker file, but I was hoping for a more elegant method. Thanks! Rob
Technical Details
Message-ID:
<45e797e2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,425c3313c9d5dcd8,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 01 Mar 2007 22:20:01 -0500 From: "Robert G. Hoover" <not.a.real.address@anywhere.sorry> User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: read/write semiphores? X-Enigmail-Version: 0.94.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000720-0, 03/01/2007), Outbound message X-Antivirus-Status: Not-Tested NNTP-Posting-Host: 68.48.157.44 Message-ID: <45e797e2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172805602 68.48.157.44 (1 Mar 2007 19:20:02 -0800) Lines: 17 Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail