BOOL GetFileTime( HANDLE hFile, // handle to file LPFILETIME lpCreationTime, // creation time LPFILETIME lpLastAccessTime, // last access time LPFILETIME lpLastWriteTime // last write time ); On NTFS, access time has a resolution of 1 hour. Therefore, GetFileTime may not return the same file time information set using the SetFileTime function.
BOOL GetFileAttributesEx( LPCTSTR lpFileName, // file or directory name GET_FILEEX_INFO_LEVELS fInfoLevelId, // attribute class LPVOID lpFileInformation // attribute information ); ---------------------- WIN32_FILE_ATTRIBUTE_DATA The WIN32_FILE_ATTRIBUTE_DATA structure contains attribute information for a file or directory. The GetFileAttributesEx function uses this structure.typedef struct _WIN32_FILE_ATTRIBUTE_DATA{ DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; } WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;
HANDLE hFile, // handle to file
LPFILETIME lpCreationTime, // creation time
LPFILETIME lpLastAccessTime, // last access time
LPFILETIME lpLastWriteTime // last write time
);
On NTFS, access time has a resolution of 1 hour. Therefore, GetFileTime may not return the same file time information set using the SetFileTime function.
LPCTSTR lpFileName, // file or directory name
GET_FILEEX_INFO_LEVELS fInfoLevelId, // attribute class
LPVOID lpFileInformation // attribute information );
----------------------
WIN32_FILE_ATTRIBUTE_DATA
The WIN32_FILE_ATTRIBUTE_DATA structure contains attribute information for a file or directory. The GetFileAttributesEx function uses this structure.typedef struct _WIN32_FILE_ATTRIBUTE_DATA{
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
} WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;
难道不行么?这些取得时间似乎都是文件的最后访问时间,但是我打开一个文件再关闭,这个时间并不更新啊(NTFS系统且已经过了1天……)