writeln(IntToStr(FileSize(sfile)), ' bytes');
Whoa! It’s also been quite a while since you’ve used
write/
writeLn? You can just pass an integer value to
writeLn, no need for
intToStr.
It still gives the "unhandled issue occured" and "access denied"
but when I started Lazarus as Administrator it stays say.
Well, these exceptions aren’t raised without a reason: You have to be authorized to access every component along the entire specified
path. Maybe, for debugging insert a
writeLn for
getCurrentDir and
path?
Try this: https://www.freepascal.org/docs-html/rtl/system/filesize.html
Note, this returns the number of “records” and a record for an
untyped file is by default 128 Bytes, unless you do
reset(sFile, 1); (so
1 defines a record’s size in Bytes).