La mia versione:
Public Sub Form_Open()
Dim fl As File
Dim i As Integer
Dim a, b As Byte
fl = Open "/percorso/del/file" For Read
For a = 0 To 2
Read #fl, b
i += b * 2 ^ (8 * a)
Next
fl.Close
Print i
End
Così forse?
La butto li che ora non ho tempo di testare.
Public Sub Form_Open()
Dim fl As File
Dim i As Integer
Dim a, b As Byte
fl = Open "/percorso/del/file" For Read
For a = 0 To 2
Read #fl, b
i += b * 2 ^ (8 * (2- a))
Next
fl.Close
Print i
End
Così forse?
Va bene, bravo: hai risolto.
Metterò il tuo codice in wiki con citazione " magna cum laude " !
Avresti potuto fare anche così:
Public Sub Main()
Dim fl As File
Dim i As Integer
Dim b As Byte
Dim c As Short
fl = Open "/percorso/del/file" For Read
For c = 2 To 0 Step -1
Read #fl, b
i += b * 2 ^ (8 * c)
Next
fl.Close
Print i, Hex(i, 6)
End