Find value from longfill
Hello,
What I want to know is how to loop through say three longs that i have used the "LONGFILL" instruction to enter the values to see if they match a know value then execute a function if they match.
What I want to know is how to loop through say three longs that i have used the "LONGFILL" instruction to enter the values to see if they match a know value then execute a function if they match.
Comments
pub lcompare(pntr1, pntr2, len) | count count := 0 repeat len if (long[pntr1][count] == long[pntr2][count]) count += 1 else quit return (count == len)
You have to pass the addresses of the arrays you want to check, as well as the length. If they match, you get true back, otherwise false.
VAR long longvars[3] long ok, i PUB TestIt longfill(@longvars, 9999, 3) 'fill the 3 longs ok := true repeat i from 0 to 2 if longvars[i] <> 9999 'test if value matches ok := false
If you only have a pointer to the 3 longs then use the methode that JonnyMac shows.Andy
Let me see if I understand you gentlemen right if I have the Pointer name and Length of the long I am looking for then Jon's example will return true it if it is match. If I want to scan each Value in an array of longs then Andy's example will look at each Value not just the name and length. Is this Correct?