Article View: borland.public.cppbuilder.nativeapi
Article #14672Re: Lock File
From: Remy Lebeau (TeamB)
Date: Wed, 06 Aug 2003 16:51
Date: Wed, 06 Aug 2003 16:51
21 lines
1988 bytes
1988 bytes
"JD" <nospam@nospam.com> wrote in message news:3f312f89$1@newsgroups.borland.com... > As soon as I clicked Post I knew I didn't provide > enough info. I want to use TStringList->LoadFromFile > which just opens the file for reading and closes it right away. > > I can make the change in milliseconds and write it back out > right away but that's not good enough. I need a method that > *guarantees* that only one instance of the program can modify > the file at any one time. Don't use LoadfromFile() then. Use LoadFromStream() instead. That way, you can open your own TFileStream with exclusive access to the file, and keep the stream alive for the duration of the modifications. The alternative is to not use streams at all, but open the file using API functions directly, and load/save the data manually. Gambit
Technical Details
Message-ID:
<3f31309e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!diablo.voicenet.com!prodigy.com!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f310f5c$1@newsgroups.borland.com> <VA.00001e88.01939e59@email.address.sorry> <3f312f89$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,98f8eb89363be2d X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-06 10:10:35 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f310f5c$1@newsgroups.borland.com> <VA.00001e88.01939e59@email.address.sorry> <3f312f89$1@newsgroups.borland.com> Subject: Re: Lock File Date: Wed, 6 Aug 2003 09:51:36 -0700 Lines: 23 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3f31309e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1060188318 207.175.226.26 (6 Aug 2003 09:45:18 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!diablo.voicenet.com!prodigy.com!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail