Windows has an API function called GetFileTime() ( doc on MSDN ), taking the file descriptor in the parameter and 3 FILETIME structures that will be with date and time information:
FILETIME creationTime, lpLastAccessTime, lastWriteTime; bool err = GetFileTime( h, &creationTime, &lpLastAccessTime, &lastWriteTime ); if( !err ) error
The FILETIME structure FILETIME obfuscated, use the FileTimeToSystemTime() function to translate it into the SYSTEMTIME structure, which is easier to use:
SYSTEMTIME systemTime; bool res = FileTimeToSystemTime( &creationTime, &systemTime ); if( !res ) error
Then you can use the fields wYear , wMonth , etc. for comparison with your number of days.
Julien-l
source share