How can we compare two structures between them?
I mean compare values of structure 1 members EQUAL to values of structure 2 members, like IF STRUCTURE 1 = STRUCTURE 2 THEN....
Thank you.
Best regards,
Zdenko.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-11-20
Originally created by: scott_cunningham
You use pointers and compare each byte of the first with the second. See BUFFER_COMP in the OSCAT library for a free, already existing function. Otherwise you can make your own. SIZEOF() will tell you how many bytes to compare.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the memory library is a function "compare".
This uses 2 pointers to memory blocks.
If the result is 0, they are the same, otherwise the return value refers to the first byte where the difference is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
How can we compare two structures between them?
I mean compare values of structure 1 members EQUAL to values of structure 2 members, like IF STRUCTURE 1 = STRUCTURE 2 THEN....
Thank you.
Best regards,
Zdenko.
Originally created by: scott_cunningham
You use pointers and compare each byte of the first with the second. See BUFFER_COMP in the OSCAT library for a free, already existing function. Otherwise you can make your own. SIZEOF() will tell you how many bytes to compare.
Thank you Scott,
I already implemented this as you suggested. It works fine.
Best regards,
Zdenko.
In the memory library is a function "compare".
This uses 2 pointers to memory blocks.
If the result is 0, they are the same, otherwise the return value refers to the first byte where the difference is.