Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2000-09

Error in UNITS doc...

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

C.Keck

Hi,

I think I found an error in the FPC documentation. It's about that command "CompareMem" from the Sysutils unit. The doc says that it should give back an integer result, but the compiler seems to expect a boolean?!?
Btw: Is there a function that compares two memory areas (e.g. a small pattern within a huge buffer) and gives back the position where the pattern is found? Would be very handy if so.

Cheers,
Chris

Reply by email

Unknown author
Show quoted text 9 lines
Hi, I think I found an error in the FPC documentation. It's about that command "CompareMem" from the Sysutils unit. The doc says that it should give back an integer result, but the compiler seems to expect a boolean?!? Btw: Is there a function that compares two memory areas (e.g. a small pattern within a huge buffer) and gives back the position where the pattern is found? Would be very handy if so.

You can use the following FPC specific functions from the system unit (available since 1.00):

function  CompareChar(var buf1,buf2;len:longint):longint;
function  CompareByte(var buf1,buf2;len:longint):longint;
function  CompareWord(var buf1,buf2;len:longint):longint;
function  CompareDWord(var buf1,buf2;len:longint):longint;

Reply by email

C.Keck

Original message from:

Show quoted text 17 lines
> Hi, > > I think I found an error in the FPC documentation. > It's about that command "CompareMem" from the Sysutils unit. > The doc says that it should give back an integer result, but the > compiler seems to expect a boolean?!? > Btw: Is there a function that compares two memory areas (e.g. a small > pattern within a huge buffer) and gives back the position where > the pattern is found? Would be very handy if so. You can use the following FPC specific functions from the system unit (available since 1.00): function CompareChar(var buf1,buf2;len:longint):longint; function CompareByte(var buf1,buf2;len:longint):longint; function CompareWord(var buf1,buf2;len:longint):longint; function CompareDWord(var buf1,buf2;len:longint):longint;

Thanks for the help...But why is there nothing about this in the docs?

Reply by email