Recent

Author Topic: function CompareFilenames(const Filename1, Filename2: string): integer; inline;  (Read 1916 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
I'm trying to learn Window programing with Free Pascal but it's difficult.

In this function am I reading this right?

function CompareFilenames(const Filename1, Filename2: string): integer; inline;

Call the function with a Const, Filename1, Filename2 all string types and the function returns an integer and an inline.

Whats an inline.

I got the function description from:

http://wiki.lazarus.freepascal.org/fileutil

Const
   c : 'some string';
.
.

Var
  i : integer;

Begin
.
.
i := CompareFilenames(c, 'myFile.txt', 'yourFile.txt' );

I dont understand the inline?
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Inline is used to tell the compiler to optimize the procedure for speed instead of for size. You can simply ignore it.
https://freepascal.org/docs-html/ref/refsu73.html

I never use CompareFileNames so I can't comment about it.

The documentation in the link you provided does not give useful information for beginners. Maybe you can try this:
https://www.freepascal.org/docs-html/rtl/sysutils/ansicomparefilename.html

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
CompareFilenames returns 0 if the filenames ar "the same".
Amongs others it takes into account tha on Windows filenames are not case sensitive, whilst on *nix they are.

Bart

 

TinyPortal © 2005-2018