马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
这是我用vb.net写的,才学几天,大家多关照:
我把幻灯的地址也放进去了,省的又再找一遍.
- Function tohex(ByVal address() As Byte) As String
- Dim i As Integer = 3, a As String = "", b As String
- For i = 3 To 0 Step -1
- b = Hex(address(i))
- If (Len(b)) < 2 Then
- b = "0" + b
- End If
- a = a + b
- Next i
- tohex = "&H" + a
- End Function
- Function getallname(ByVal file As String, ByRef all() As String, ByRef all_add() As String) As String()
- Dim i As Integer, name(31), add(3) As Byte
- Dim allname(0), a, address(0) As String
- Dim fs As FileStream = New FileStream(file, FileMode.Open, FileAccess.Read)
- Dim r As New BinaryReader(fs)
- name = r.ReadBytes(32)
- While name(0) <> 0
- a = ""
- i = 0
- name = r.ReadBytes(32)
- add = r.ReadBytes(4)
- While name(i) <> 0
- a = a + (Chr(name(i)))
- i += 1
- End While
- If a <> "" Then
- allname(allname.Length - 1) = a
- ReDim Preserve allname(allname.Length)
- address(address.Length - 1) = (tohex(add))
- ReDim Preserve address(address.Length)
- End If
- End While
- fs.Close()
- all = allname
- all_add = address
- Return allname
- End Function
这是vb写的.
- Public Function ReadSLBNames(strFile As String) As Variant
- Dim lngFile As Long
- Dim strTemp As String
- Dim lngCnt As Long
- Dim strVals() As String
- Dim varRet As Variant
- Dim intcnt As Integer
- On Error GoTo Err_Control
- lngFile = FreeFile()
- lngCnt = 33
- Open strFile For Binary As #lngFile
- Do While Not EOF(1)
- Seek lngFile, lngCnt
- Line Input #lngFile, strTemp
- If Not strTemp = vbNullString Then
- ReDim Preserve strVals(intcnt)
- strVals(intcnt) = strTemp
- intcnt = intcnt + 1
- lngCnt = lngCnt + 36
- Else
- Exit Do
- End If
- Loop
- Close lngFile
- varRet = strVals
- ReadSLBNames = varRet
- Exit_Here:
- Exit Function
- Err_Control:
- Select Case Err.Number
- 'Add additional Case selections here
- Case Else
- MsgBox Err.Description
- Err.Clear
- Resume Exit_Here
- End Select
- End Function
|