Recent

Author Topic: Lazarus FileSize function a little strange?  (Read 17289 times)

ynys

  • New Member
  • *
  • Posts: 10
Lazarus FileSize function a little strange?
« on: August 02, 2010, 02:47:02 am »
infile: file of byte;
Infilename: string;
size: longint;

now after

Assignfile(infile, infilename)

infilename a string containing name of file on disk infile the actual file made up of bytes of info

The accepted way of finding the size in bytes of this file in turbo pascal, delphi and (think) freepascal is

size := FileSize(infile)

BUT this does not seem to work with lazarus

whereas

size := FileSize(infilename);

does!

Which seems a bit wierd - why differ from the pascal norm?

Any ideas?

Regards
ynys

typo

  • Hero Member
  • *****
  • Posts: 3051
« Last Edit: August 02, 2010, 02:57:21 am by typo »

captian jaster

  • Guest
Re: Lazarus FileSize function a little strange?
« Reply #2 on: August 02, 2010, 04:37:19 am »
The System(Unit) FileSize Asks for a file type
So the file has to be assigned first..
the FileUtil asks for a string of the file name..
If you want to test that one but FileUtil in the Uses clause and put
FileUtil.FileSize..

 

TinyPortal © 2005-2018