程序如下:double HttpDownload::getLocalFileSize()
{
     CFileFind fileFinder;
 
 if(0 != fileFinder.FindFile((LPCTSTR)localFile))
 {
  
 double length = fileFinder.GetLength();
 return  length;
 }
 else
 return 0;
}

解决方案 »

  1.   

    localFile是什么?哪来的?
    还有,看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 
      

  2.   

    楼上的大哥,localFile是文件的路径类似“C:\\temp\\xxx.exe”
      

  3.   

    double HttpDownload::getLocalFileSize()
    {
         CFileFind fileFinder;
         
         if(0 != fileFinder.FindFile((LPCTSTR)localFile))
         {
             fileFinder.FindNext();// 必须先调用这个函数才可以获取真正查找到的文件,看看MSDN
             double length = fileFinder.GetLength();
             return  length;
         }
         else
             return 0;
    }
      

  4.   

    上面大牛都说得好:
    要FindNextFile()