function FileSize64(var F : File): Int64;
var
ph :_stat;
pl:longword;
begin
pl := fstat(TFileRec(f).Handle, ph);
if (pl = $ffffffff) and (GetLastError <> 0) then
CreateIOException(GetLastError, 'FileSize64', f, false);
FileSize64 := Int64(ph) shl 32 + pl;
end;
I am getting an error:
E2089 Invalid typecast
FileSizeByName
inIdGlobalProtocols
unit. – RepeatUntil Jan 21 at 10:02fstat()
returns anInteger
not aLongWord
. And the return value is not a byte size. And you don't need to checkGetLastError()
before raising the exception:if fstat(...) < 0 then CreateIOException(...);
– Remy Lebeau Jan 22 at 15:43