Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DanielH

memcmp in delphi

This topic is 5529 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a function like memcmp in C/C++ in delphi? I need to see if two records are the same.

Share this post


Link to post
Share on other sites
Advertisement
From the delphi help

CompareMem

Performs a binary comparison of two memory images.

Unit - Sysutils

function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;

CompareMem performs a binary compare of Length bytes of memory referenced by P1 to that of P2. CompareMem returns True if the memory referenced by P1 is identical to that of P2.

Hope it helps

Mark

Share this post


Link to post
Share on other sites
I found the function just after i created this thread. But i dont get the function to work like i want to!

CompareMem(@struct,@struct,sizeof(TStruct))

..this returns true but...

struct2 := struct1;
CompareMem(@struct1, @struct2,sizeof(TStruct));

..returns false...

And now i need to compare two diffrent objects from the same record.

How? :o

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!