mi6agent
asked on
Get size of file
before anyone gives me examples read on first.......
Does anyone have examples on how to use the Windows API to get the size of a file in bytes - must be able to handle HUGE files (ie: any size of file on a Windows system 4Gb upwards).
I want to use Windows API as i am assuming it is faster than going through the delphi way.
Does anyone have examples on how to use the Windows API to get the size of a file in bytes - must be able to handle HUGE files (ie: any size of file on a Windows system 4Gb upwards).
I want to use Windows API as i am assuming it is faster than going through the delphi way.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
LoL, sorry, didn't see Geo's comment... didn't press Refresh :-p
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to both of you - i have raised the points and split them to give origianl 125 points each.
DragonSlayer - i used your code BUT changed OPEN_ALWAYS to OPEN_EXISTING - OPEN_ALWAYS will create the file if it is not found.
DragonSlayer - i used your code BUT changed OPEN_ALWAYS to OPEN_EXISTING - OPEN_ALWAYS will create the file if it is not found.
Try this:
function GetFileSize(const strFile: string): Int64;
var
SearchRec:TSearchRec;
begin
result := 0;
if (FindFirst(strFile, faAnyFile, SearchRec)=0) then begin
// File found.
result := (Int64(SearchRec.FindData.
end;
FindClose(SearchRec);
end;
usage:
ShowMessage(IntToStr(GetFi
Regards, Geo