Recent

Author Topic: Find out the size of the set of files  (Read 4232 times)

mrkaban

  • Jr. Member
  • **
  • Posts: 60
    • КонтинентСвободы
Re: Find out the size of the set of files
« Reply #15 on: June 02, 2019, 04:10:16 pm »
This helped to understand the cause of the error! The attribute "Read Only" is to blame! How can I protect the file size detection algorithm from the read-only flag?

Hi!

LOL. Is it a real question? This code works without any problem, even Program Files dir and readonly file:

Code: Pascal  [Select][+][-]
  1. uses
  2.    ,FileUtil;  
  3.  
  4. code:
  5.   ShowMessage(Format('FileSize: %d byte', [FileUtil.FileSize('c:\Program Files (x86)\_Test_\testfile.txt')]));
  6.  

Did you read anything other than the title and the last message? for example, the first. I already use this function.

totya

  • Hero Member
  • *****
  • Posts: 720
Re: Find out the size of the set of files
« Reply #16 on: June 02, 2019, 05:19:35 pm »
Did you read anything other than the title and the last message? for example, the first. I already use this function.

These two different functions ;)

You use this:

From System: function FileSize(var f: file):Int64;

I talking about this:

From FileUtil: function FileSize(const Filename: string):Int64; overload;

mrkaban

  • Jr. Member
  • **
  • Posts: 60
    • КонтинентСвободы
Re: Find out the size of the set of files
« Reply #17 on: June 02, 2019, 05:29:26 pm »
Did you read anything other than the title and the last message? for example, the first. I already use this function.

These two different functions ;)

You use this:

From System: function FileSize(var f: file):Int64;

I talking about this:

From FileUtil: function FileSize(const Filename: string):Int64; overload;

But when I hold down the CTRL and left-click on FileSize in "V1: = FileSize (MyFile);", it shows this function:
function FileSize(const Filename: string): int64; overload; inline;

I do not understand how to change the code for it:
V1:= FileUtil.FileSize(MyFile);

but then he writes the following error, v1 type LongInt:
Error: Incompatible type for arg no. 1: Got "File", expected "AnsiString"

mrkaban

  • Jr. Member
  • **
  • Posts: 60
    • КонтинентСвободы
Re: Find out the size of the set of files
« Reply #18 on: June 02, 2019, 05:31:49 pm »
Did you read anything other than the title and the last message? for example, the first. I already use this function.

These two different functions ;)

You use this:

From System: function FileSize(var f: file):Int64;

I talking about this:

From FileUtil: function FileSize(const Filename: string):Int64; overload;

Everything, I understood, is my file type, and this is a normal string.

Thank!

 

TinyPortal © 2005-2018