🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2449

Re: File access syncronization

#2449
From: Bob Gonder
Date: Mon, 19 Feb 2007 03:15
17 lines
1702 bytes
Goran Ekstrom wrote:

>It is this Open-then-delete part in the reader app. that I am wondering
>about. How can I open, close, delete without any access time gaps here? One
>idea is to rename the file, assuming the rename function is lock aware but
>there is only a STDIO function called "rename" available as i seems. Will
>this function do or do you have any other ideas?

Sure.
If rename fails, then either the file doesn't exist (you can check
that) or it is locked.
If rename doesn't fail, then you can open it with it's new name.

This has the advantage that the writter can start writing right away.

You can also use CreateFile() with the FILE_FLAG_DELETE_ON_CLOSE
option to read and delete the file.
Technical Details
Message-ID: <v15it2loaaaon5j1l328df9fobgi9v8fcr@4ax.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45d8c9b8$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b0ad3456f545786c
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: File access syncronization
Date: Sun, 18 Feb 2007 19:15:30 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <v15it2loaaaon5j1l328df9fobgi9v8fcr@4ax.com>
References: <45d8c9b8$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.88.225
X-Trace: newsgroups.borland.com 1171854899 69.69.88.225 (18 Feb 2007 19:14:59 -0800)
Lines: 20
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail