Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use the Windows API which provides a set of directory search functions. When using the directory search you specify a file search criteria and then do repeated calls until there are no more files or you have found the one you want.</p> <p>The nice thing about these functions is that as part of returning the next file in the directory, there is also returned a struct containing various file attributes including the date and time stamps as well as whether the file is hidden or not.</p> <p>So you could use a loop something like the following source code snip:</p> <pre><code>WIN32_FIND_DATA search_data; uInt2++; TCHAR *ptcsFileNameEnd = tcsFileName + _tcslen(tcsFileName); _tcscat (ptcsFileNameEnd, _T("\\*.*")); memset(&amp;search_data, 0, sizeof(WIN32_FIND_DATA)); HANDLE handle = FindFirstFile(tcsFileName, &amp;search_data); while(handle != INVALID_HANDLE_VALUE) { if ((search_data.dwFileAttributes &amp; (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN)) == 0) { *(ptcsFileNameEnd + 1) = 0; _tcscat (ptcsFileNameEnd, search_data.cFileName); if (ReadAndProcessLicenseFile (tcsFileName)) { uInt2 = 0; break; } } if(FindNextFile(handle, &amp;search_data) == FALSE) break; } </code></pre> <p>In your case you would look at the search_data struct for the date time stamp and do comparisons.</p> <p><strong>EDIT</strong> The struct WIN32_FIND_DATA is defined in winbase.h and the struct looks like the following for my Visual Studio C++ 2005 environment with UNICODE turned on.</p> <pre><code>typedef struct _WIN32_FIND_DATAW { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; WCHAR cFileName[ MAX_PATH ]; WCHAR cAlternateFileName[ 14 ]; #ifdef _MAC DWORD dwFileType; DWORD dwCreatorType; WORD wFinderFlags; #endif } WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW; #ifdef UNICODE typedef WIN32_FIND_DATAW WIN32_FIND_DATA; typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA; typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA; #else </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload