DWORD GetLength( ) const;
Return Value
The length of the found file, in bytes.
Remarks
Call this member function to get the length of the found file, in bytes. You must call FindNextFile at least once before calling GetLength.
GetLength uses the nFileSizeLow member of the Win32 structure, WIN32_FIND_DATA, to get and return the low-order DWORD value of the file size, in bytes. If the file may be more than four gigabytes in size, use the GetLength64 member.
Example
// 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(_T("%s\n\t"), (LPCTSTR) finder.GetFileName());
_tprintf(_T("%c"), finder.IsArchived() ? 'A' : 'a');
_tprintf(_T("%c"), finder.IsCompressed() ? 'C' : 'c');
_tprintf(_T("%c"), finder.IsHidden() ? 'H' : 'h');
_tprintf(_T("%c"), finder.IsNormal() ? 'N' : 'n');
_tprintf(_T("%c"), finder.IsReadOnly() ? 'R' : 'r');
_tprintf(_T("%c"), finder.IsSystem() ? 'S' : 's');
_tprintf(_T("%c"), finder.IsTemporary() ? 'T' : 't');
_tprintf(_T("\t%I64u byte(s)\n"), finder.GetLength());
CTime tempTime;
CString str;
_tprintf(_T("\tCreated : "));
if (finder.GetCreationTime(tempTime))
{
str = tempTime.Format(_T("%c"));
_tprintf(_T("%s\n"), (LPCTSTR) str);
}
else
_tprintf(_T("(unavailable)\n"));
_tprintf(_T("\tLast Access: "));
if (finder.GetLastAccessTime(tempTime))
{
str = tempTime.Format(_T("%c"));
_tprintf(_T("%s\n"), (LPCTSTR) str);
}
else
_tprintf(_T("(unavailable)\n"));
_tprintf(_T("\tLast Write : "));
if (finder.GetLastWriteTime(tempTime))
{
str = tempTime.Format(_T("%c"));
_tprintf(_T("%s\n"), (LPCTSTR) str);
}
else
_tprintf(_T("(unavailable)\n"));
_tprintf(_T("\n"));
}