程序如下:double HttpDownload::getLocalFileSize()
{
CFileFind fileFinder;
if(0 != fileFinder.FindFile((LPCTSTR)localFile))
{
double length = fileFinder.GetLength();
return length;
}
else
return 0;
}
{
CFileFind fileFinder;
if(0 != fileFinder.FindFile((LPCTSTR)localFile))
{
double length = fileFinder.GetLength();
return length;
}
else
return 0;
}
还有,看msdnCFileFind finder;
BOOL bWorking = finder.FindFile("*.*");
while (bWorking)
{
bWorking = finder.FindNextFile();
cout << (LPCTSTR) finder.GetFileName() << endl;
}ResCall this member function to open a file search.After calling FindFile to begin the file search, call FindNextFile to retrieve subsequent files. You must call FindNextFile at least once before calling any of the following attribute member functions: GetCreationTime
GetFileName
GetFileTitle
GetFilePath
GetFileURL
GetLastAccessTime
GetLastWriteTime
GetLength
GetRoot
{
CFileFind fileFinder;
if(0 != fileFinder.FindFile((LPCTSTR)localFile))
{
fileFinder.FindNext();// 必须先调用这个函数才可以获取真正查找到的文件,看看MSDN
double length = fileFinder.GetLength();
return length;
}
else
return 0;
}
要FindNextFile()