Article View: borland.public.cppbuilder.nativeapi
Article #2097Re: How to effectively modify the last access time of a file
From: Mark Jacobs
Date: Thu, 05 Apr 2007 12:25
Date: Thu, 05 Apr 2007 12:25
20 lines
1953 bytes
1953 bytes
"Koen" <koen@ha.com> wrote in message news:Xns990966E8E657Fkoenhacom@207.105.83.66... > JF Jolin wrote: >> hFile = CreateFile( lpszFileName, GENERIC_READ | GENERIC_WRITE, 0, >> NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); >> SetFileTime( hFile, &fTimeCreate, &fTimeLastAccess, &fTimeLastWrite ); >> CloseHandle( hFile ); > > 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! -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk
Technical Details
Message-ID:
<4614eacb@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<op.tqajwtlyjr09w3@localhost> <Xns990966E8E657Fkoenhacom@207.105.83.66>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,69dd2e4db7d54b87 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> Newsgroups: borland.public.cppbuilder.nativeapi References: <op.tqajwtlyjr09w3@localhost> <Xns990966E8E657Fkoenhacom@207.105.83.66> Subject: Re: How to effectively modify the last access time of a file Date: Thu, 5 Apr 2007 13:25:40 +0100 Lines: 21 Organization: DK Computing MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 81.144.157.8 Message-ID: <4614eacb@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1175775947 81.144.157.8 (5 Apr 2007 05:25:47 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail