#include "stdafx.h"
void test()
{
// Get File Name List
CStringList listName;
CFileFind finder;
BOOL bWorking = finder.FindFile("*.*"); // current directory?
while (bWorking)
{
bWorking = finder.FindNextFile();
// in three days
CTime tempTime;
CTime TimeNow = CTime::GetCurrentTime();
finder.GetLastWriteTime(tempTime);
CTimeSpan TimeSpan;
TimeSpan = TimeNow - tempTime;
if( TimeSpan.GetTotalMinutes() < 3*24*60 )
listName.AddTail(finder.GetFileName());
}
//Get Min and Max File Number
CString szFileName;
int minFilename , maxFilename , tempFilename ;
POSITION pos = listName.GetHeadPosition();
if( pos != NULL )
{
szFileName = listName.GetNext( pos );
tempFilename= atoi(szFileName );
minFilename = tempFilename;
maxFilename = tempFilename;
}
while ( pos != NULL )
{
szFileName = listName.GetNext( pos );
tempFilename= atoi(szFileName );
if( tempFilename > maxFilename )
maxFilename = tempFilename ;
if( tempFilename < minFilename )
minFilename = tempFilename ;
}
// get what is missing
for( int iFileName = minFilename; iFileName < maxFilename ; iFileName++ )
{
CFile DataFile;
CFileException fe;
CString strValue;
strValue.Format( "%d", iFileName);
if ( !DataFile.Open( strValue, CFile::modeRead , &fe) )
{
// i am here
}
}
}