![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
WIN32_FIND_DATA (большой размер файла) [D7, Win95/98, WinME, NT4, Win2k, WinXP]
Sun bittern © (2005-01-04 20:05:00)Доброго вечера!
var
FSize: Int64;
WinFindData: PWin32FindData;
nFileSizeHigh
High-order DWORD value of the file size, in bytes. This value is zero unless the file size is greater than MAXDWORD. The size of the file is equal to (nFileSizeHigh * (MAXDWORD+1)) + nFileSizeLow.
Так не нравится:
FSize := (WinFindData^.nFileSizeHigh * ( High(DWORD) + 1)) + WinFindData^.nFileSizeLow;
А так в самый раз:
FSize := (WinFindData^.nFileSizeHigh * High(DWORD)) + WinFindData^.nFileSizeLow;
Т.е. не дает мне единичку прибавить :( : MAXDWORD+1
Хотя High(Int64) корректно обрабатывается.
Можно конечено и так:
A := High(DWORD);
FSize := (WinFindData^.nFileSizeHigh * (A + 1)) + WinFindData^.nFileSizeLow;
Просто интересно стало, почему способ выше не канает?
Sun bittern (2005-01-04 20:52:00) [1]Теперь ясно :)
ламер (2005-01-04 20:32:00) [2]Sun bittern © (05.01.04 20:25) [4]
In general, arithmetic operations on integers return a value of type Integer—which, in its current implementation, is equivalent to the 32-bit Longint. Operations return a value of type Int64 onlywhen performed on an Int64 operand.
begin...end (2005-01-04 20:28:00) [3]> [4] Sun bittern © (04.01.05 20:25)
> Но ведь может ведь результат вернуть High(Int64) и почему
> с переполнением выпендривается?
Не понял вопроса.
Sun bittern (2005-01-04 20:25:00) [4]Int64(High(DWORD)) + 1
Ага так идет. Но ведь может ведь результат вернуть High(Int64) и почему с переполнением выпендривается? Проблема решена :)
GuAV (2005-01-04 20:19:00) [5]Int64Rec(I).Hi
Int64Rec(I).Lo
begin...end (2005-01-04 20:18:00) [6]> Sun bittern © (04.01.05 20:05)
Дело в переполнении.
Попробуйте так:
FSize := (WinFindData^.nFileSizeHigh * ( Int64(High(DWORD) )+ 1)) + WinFindData^.nFileSizeLow
ламер (2005-01-04 20:17:00) [7]может, (Int64(High(DWord)) + 1)?