- this structure comparison works only if you replace unlimited strings by fixed strings.
Code: Select all
#MaxCharacters=$FF
Structure country
name.s{#MaxCharacters} ; fixed string ( 256 characters )
townCount.i
towns.s{#MaxCharacters}[10] ;array of fixed strings ( 256 characters per string )
*history
EndStructure
Macro CompareCountry(this, other)
CompareMemory(@this, @other, SizeOf(country))
EndMacro
thisCountry.country
thisCountry\name="Funky Land"
thisCountry\townCount=2
thisCountry\towns[0]="Small-City"
thisCountry\towns[1]="Barney Ville"
thisCountry\history=AllocateMemory(1024)
;structure affectation
otherCountry.country =thisCountry
If CompareCountry(thisCountry, otherCountry)
Debug "same country"
EndIf