Created
September 5, 2017 14:22
-
-
Save wellington1993/a499bea50996c2e47309af079d452090 to your computer and use it in GitHub Desktop.
Delphi Function FileSize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns file size in bytes or -1 if not found. | |
function FileSize(fileName : wideString) : Int64; | |
var | |
sr : TSearchRec; | |
begin | |
if FindFirst(fileName, faAnyFile, sr ) = 0 then | |
result := Int64(sr.FindData.nFileSizeHigh) shl Int64(32) + Int64(sr.FindData.nFileSizeLow) | |
else | |
result := -1; | |
FindClose(sr); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment