다음을 통해 공유


CFileFind::GetLength

길이 (바이트)에서에서 찾은 파일을 가져오려면이 함수를 호출 합니다.

ULONGLONG GetLength( ) const;

반환 값

찾은 파일을 바이트에서 길이입니다.

설명

호출 해야 FindNextFile 호출 하기 전에 적어도 한 번 GetLength.

GetLengthWin32 구조를 사용 하 여 WIN32_FIND_DATA 를 가져오고 값을 파일 크기를 바이트 단위로 반환 합니다.

[!참고]

현재 MFC 7.0 GetLength 64 비트 정수 형식 지원.이전에이 라이브러리의 최신 버전으로 작성 된 기존 코드에서 잘림 경고가 발생할 수 있습니다.

예제

// 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"));
} 

요구 사항

헤더: afx.h

참고 항목

참조

CFileFind 클래스

계층 구조 차트