[CODE=vb]Private Sub cmdscan_Click()
Const a As Byte = 4
Const b As Byte = &HFF
Dim I As Long
Dim AnyChanged As Boolean
Dim changeMade As Boolean
Dim value As Byte
'Dim x
'Dim tmp As String
For I = 1 To 100 Step 6
AnyChanged = False
Debug.Print "Before : "; HexByte2Char(ar rByte(I)); " "; HexByte2Char(ar rByte(I + 1)); " "; HexByte2Char(ar rByte(I + 2)); _
" "; HexByte2Char(ar rByte(I + 3)); " "; HexByte2Char(ar rByte(I + 4)); " "; HexByte2Char(ar rByte(I + 5))
' Print HexByte2Char(I)
If arrByte(I) <> a Then
arrByte(I) = a
value = a
changeMade = True
End If
If arrByte(I + 1) <> b Then
arrByte(I + 1) = b
changeMade = True
End If
If changeMade Then
AnyChanged = True
Debug.Print "After : "; HexByte2Char(ar rByte(I)); " "; HexByte2Char(ar rByte(I + 1)); " "; HexByte2Char(ar rByte(I + 2)); _
" "; HexByte2Char(ar rByte(I + 3)); " "; HexByte2Char(ar rByte(I + 4)); " "; HexByte2Char(ar rByte(I + 5)); _
" <--- Corrected"
End If
Debug.Print
Next
End Sub[/CODE]
this is the way i open the file
[CODE=vb]Open "a:\bonding .bin " For Binary As mHandle
'Open gcdg.FileName For Binary As #mHandle
mFileSize = LOF(mHandle)
If mFileSize = 0 Then
Close mHandle
MsgBox "Empty file"
Exit Sub
End If
Screen.MousePoi nter = vbCross
ReDim arrByte(1 To mFileSize)
Get #mHandle, , arrByte
Close mHandle
rtbChr.Text = ""
rtbChr.LoadFile gcdg.FileName[/CODE]
actualy just know u mention to me that ask me to figure out where the problem occur.When i try to loop from byte 1 to 100 it can loop and give the output.When i try to put 1 to mfilesize it cant loop and it stuck.I do no why its happening.The mFilesize is the end of file.When i try to open the file in the binary editor that i did it can read until end of file.im asking why it cant read until end of file.
Const a As Byte = 4
Const b As Byte = &HFF
Dim I As Long
Dim AnyChanged As Boolean
Dim changeMade As Boolean
Dim value As Byte
'Dim x
'Dim tmp As String
For I = 1 To 100 Step 6
AnyChanged = False
Debug.Print "Before : "; HexByte2Char(ar rByte(I)); " "; HexByte2Char(ar rByte(I + 1)); " "; HexByte2Char(ar rByte(I + 2)); _
" "; HexByte2Char(ar rByte(I + 3)); " "; HexByte2Char(ar rByte(I + 4)); " "; HexByte2Char(ar rByte(I + 5))
' Print HexByte2Char(I)
If arrByte(I) <> a Then
arrByte(I) = a
value = a
changeMade = True
End If
If arrByte(I + 1) <> b Then
arrByte(I + 1) = b
changeMade = True
End If
If changeMade Then
AnyChanged = True
Debug.Print "After : "; HexByte2Char(ar rByte(I)); " "; HexByte2Char(ar rByte(I + 1)); " "; HexByte2Char(ar rByte(I + 2)); _
" "; HexByte2Char(ar rByte(I + 3)); " "; HexByte2Char(ar rByte(I + 4)); " "; HexByte2Char(ar rByte(I + 5)); _
" <--- Corrected"
End If
Debug.Print
Next
End Sub[/CODE]
this is the way i open the file
[CODE=vb]Open "a:\bonding .bin " For Binary As mHandle
'Open gcdg.FileName For Binary As #mHandle
mFileSize = LOF(mHandle)
If mFileSize = 0 Then
Close mHandle
MsgBox "Empty file"
Exit Sub
End If
Screen.MousePoi nter = vbCross
ReDim arrByte(1 To mFileSize)
Get #mHandle, , arrByte
Close mHandle
rtbChr.Text = ""
rtbChr.LoadFile gcdg.FileName[/CODE]
actualy just know u mention to me that ask me to figure out where the problem occur.When i try to loop from byte 1 to 100 it can loop and give the output.When i try to put 1 to mfilesize it cant loop and it stuck.I do no why its happening.The mFilesize is the end of file.When i try to open the file in the binary editor that i did it can read until end of file.im asking why it cant read until end of file.
Comment