Godlike29
09-03-2003, 05:53 AM
I am trying to add up the following bytes in hex
E00A0E1DA0100EBC
E0+0A+0E+1D+A0+10+0E+BC = TOTAL in hex
and then for each line with same function.
myarray(1) = E0 0A 0E 1D A0 10 0E BC 'use for example 'line 1
my array(2) FF A2....... 'line 2
my array(3)blah blah.... 'line 3
For i = 1 To UBound(myArray)
For lCtr = 1 To Len(myArray(i)) Step 2
totalbytes = totalbytes + Val("&H" & Mid(myArray(i), lCtr, 2))
Next
Print #intFileHandle, myArray(i)
Next i
Dont know why but they are not adding up in hex ?
If I use a string intead of an array then it works fine but why ?
E00A0E1DA0100EBC
E0+0A+0E+1D+A0+10+0E+BC = TOTAL in hex
and then for each line with same function.
myarray(1) = E0 0A 0E 1D A0 10 0E BC 'use for example 'line 1
my array(2) FF A2....... 'line 2
my array(3)blah blah.... 'line 3
For i = 1 To UBound(myArray)
For lCtr = 1 To Len(myArray(i)) Step 2
totalbytes = totalbytes + Val("&H" & Mid(myArray(i), lCtr, 2))
Next
Print #intFileHandle, myArray(i)
Next i
Dont know why but they are not adding up in hex ?
If I use a string intead of an array then it works fine but why ?