Aracılığıyla paylaş


CFileFind::GetLength

Bulunan dosyanın bayt cinsinden uzunluğu almak için bu üye işlevini çağırın.

ULONGLONG GetLength( ) const;

Dönüş Değeri

Bulunan dosyanın bayt cinsinden uzunluğu.

Notlar

Çağırması gerekir FindNextFile arama önce en az bir kez GetLength.

GetLengthWin32 yapısını kullanan WIN32_FIND_DATA almak ve bayt cinsinden dosya boyutu değerini döndürür.

[!NOT]

mfc 7. 0'da, tarihi itibariyle GetLength 64-bit tamsayı türlerini destekler.Daha önce bu kitaplığın yeni sürümüyle oluşturulmuş varolan bir koda kesilmesi uyarılar neden olabilir.

Örnek

// This code fragment prints out a very verbose directory
// listing for all the files in the root directory on the
// C: drive. After the file's name, each attribute of the
// file is printed, as are the creation, last access, and 
// last write times.

CFileFind finder;

BOOL bWorking = finder.FindFile(_T("C:\\*.*"));

while (bWorking)
{
   bWorking = finder.FindNextFile();

   _tprintf_s(_T("%s\n\t"), (LPCTSTR)finder.GetFileName());
   _tprintf_s(_T("%c"), finder.IsArchived()   ? 'A' : 'a');
   _tprintf_s(_T("%c"), finder.IsCompressed() ? 'C' : 'c');
   _tprintf_s(_T("%c"), finder.IsHidden()     ? 'H' : 'h');
   _tprintf_s(_T("%c"), finder.IsNormal()     ? 'N' : 'n');
   _tprintf_s(_T("%c"), finder.IsReadOnly()   ? 'R' : 'r');
   _tprintf_s(_T("%c"), finder.IsSystem()     ? 'S' : 's');
   _tprintf_s(_T("%c"), finder.IsTemporary()  ? 'T' : 't');

   _tprintf_s(_T("\t%I64u byte(s)\n"), finder.GetLength());

   CTime tempTime;
   CString str;

   _tprintf_s(_T("\tCreated    : "));
   if (finder.GetCreationTime(tempTime))
   {
      str = tempTime.Format(_T("%c"));
      _tprintf_s(_T("%s\n"), (LPCTSTR) str);
   }
   else
   {
      _tprintf_s(_T("(unavailable)\n"));
   }

   _tprintf_s(_T("\tLast Access: "));
   if (finder.GetLastAccessTime(tempTime))
   {
      str = tempTime.Format(_T("%c"));
      _tprintf_s(_T("%s\n"), (LPCTSTR) str);
   }
   else
   {
      _tprintf_s(_T("(unavailable)\n"));
   }

   _tprintf_s(_T("\tLast Write : "));
   if (finder.GetLastWriteTime(tempTime))
   {
      str = tempTime.Format(_T("%c"));
      _tprintf_s(_T("%s\n"), (LPCTSTR) str);
   }
   else
   {
      _tprintf_s(_T("(unavailable)\n"));
   }

   _tprintf_s(_T("\n"));
} 

Gereksinimler

Başlık: afx.h

Ayrıca bkz.

Başvuru

CFileFind sınıfı

Hiyerarşi grafik