Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages
Started by JF Jolin
Thu, 05 Apr 2007 03:27
How to effectively modify the last access time of a file
Author: JF Jolin
Date: Thu, 05 Apr 2007 03:27
Date: Thu, 05 Apr 2007 03:27
16 lines
1273 bytes
1273 bytes
Here is the scenario: hFile = CreateFile( lpszFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); SetFileTime( hFile, &fTimeCreate, &fTimeLastAccess, &fTimeLastWrite ); CloseHandle( hFile ); Whatever time is specified in fTimeLastAccess, that will be overwritten when CloseHandle instruction will be executed. __ JF Jolin
Re: How to effectively modify the last access time of a file
Author: Koen
Date: Thu, 05 Apr 2007 09:06
Date: Thu, 05 Apr 2007 09:06
11 lines
1190 bytes
1190 bytes
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?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads