byte count using array

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 ?

SpaceFrog
09-03-2003, 06:03 AM
How hav you declared your array ???
if it works with string you should try:

dim myarray() as string

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum