- 注册时间
- 2004-6-25
- 最后登录
- 1970-1-1
- 日志
- 阅读权限
- 50
|
发表于 2004-8-25 17:41:39
|
显示全部楼层
另外笨笨注意到三天内得要求,修正提供这个版本:
- #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
- }
- }
- }
复制代码 |
|