🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to effectively modify the last access time of a file

#2101
From: Ed Mulroy
Date: Thu, 05 Apr 2007 14:13
21 lines
1975 bytes
You are probably correct in this but there is one other thing he might try. 
I've been doing since the DOS days - do a flush on the file immediately 
prior to the time set and close.  For Win32 it goes something like this:

    FlushFileBuffers(hFile);
    SetFileTime(--arg list---);
    CloseHandle(hFile);

.  Ed

> Mark Jacobs wrote in message
> news:4614eacb@newsgroups.borland.com...
>
>> When I use your code, I the last access time is adjusted correctly. Are 
>> you sure you don't open the file elsewhere?
>
> No, he means that the CloseHandle call sets the last access time to when 
> the CloseHandle happened! I don't see a way round this! Certainly, the 
> other 2 work fine (last modified and last created), but last access 
> includes the access required to set the last access date and time - a bit 
> of a Catch 22 situation!
Technical Details
Message-ID: <46150513$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!feed10.multikabel.net!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <op.tqajwtlyjr09w3@localhost> <Xns990966E8E657Fkoenhacom@207.105.83.66> <4614eacb@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,69dd2e4db7d54b87
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <op.tqajwtlyjr09w3@localhost> <Xns990966E8E657Fkoenhacom@207.105.83.66> <4614eacb@newsgroups.borland.com>
Subject: Re: How to effectively modify the last access time of a file
Date: Thu, 5 Apr 2007 10:13:13 -0400
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 66.57.117.102
Message-ID: <46150513$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1175782675 66.57.117.102 (5 Apr 2007 07:17:55 -0800)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!feed10.multikabel.net!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail