Further to the discussion above, I can't help but wonder why use a map for this task? Since FindFirstFile and FindNextFile give you all the data you want (and more) in a single chunk, I'd just store that using a vector.
Something to toy with:
#include <iostream>
#include <string>
#include <vector>
#include <windows.h>
using namespace std;
typedef vector<WIN32_FIND_DATA> tFoundFilesVector;
int getFileList(string filespec, tFoundFilesVector &foundFiles)
{
WIN32_FIND_DATA findData;
HANDLE h;
bool validResult=true;
int numFoundFiles = 0;
h = FindFirstFile(filespec.c_str(), &findData);
if (h == INVALID_HANDLE_VALUE)
return 0;
while (validResult)
{
numFoundFiles++;
foundFiles.push_back(findData);
validResult = FindNextFile(h, &findData);
}
return numFoundFiles;
}
void showFileAge(tFoundFilesVector &fileList)
{
INT64 fileTime, curTime, age;
tFoundFilesVector::iterator iter;
CoFileTimeNow(&ftNow);
curTime = ((unsigned INT64) ftNow.dwHighDateTime << 32) + ftNow.dwLowDateTime;
for (iter=fileList.begin(); iter<fileList.end(); iter++)
{
fileTime = ((unsigned INT64)iter->ftLastWriteTime.dwHighDateTime << 32) + iter->ftLastWriteTime.dwLowDateTime;
age = curTime - fileTime;
cout << "FILE: '" << iter->cFileName << "', AGE: " << (INT64)age/10000000UL << " seconds" << endl;
}
}
int main()
{
string fileSpec = "*.*";
tFoundFilesVector foundFiles;
tFoundFilesVector::iterator iter;
int foundCount = 0;
getFileList("*.c??", foundFiles);
getFileList("*.h", foundFiles);
foundCount = foundFiles.size();
if (foundCount)
{
cout << "Found "<<foundCount<<" matching files.\n";
showFileAge(foundFiles);
}
return 0;
}