大哥是南京人?我在南京找好工作,等我到南京请你吃饭!!
'seekid是功能码用来说明本次是何操作
'fileid是文件号说明要对哪个文件进行操作
'hao:备用说明,在seekid为5或2指明要前进或后退多少,0为退2,1就是退3或进1(两行就是进2)
Dim st As String
Dim sa As String * 1
Dim sb As String * 1
Select Case seekid
Case 0
'get next
If Seek(fileid) >= LOF(fileid) Then
readfile = "seek_end"
Exit Function
End If
Do While 1
Get #fileid, , sa
If sa = Chr(16) Then
Get #fileid, , sb
If sb = Chr(17) Then
readfile = st
Seek #fileid, Seek(fileid) + 2
Exit Function
Else
Seek #fileid, Seek(fileid) - 1
End If
End If
st = st & sa
If Seek(fileid) >= LOF(fileid) Then
readfile = st
Exit Function
End If
Loop
Case 1
' go top
Seek #fileid, 1
readfile = readfile(0, fileid, 0)
Exit Function
Case 2
' go -1
If Seek(fileid) = 1 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Dim ba As Byte
Dim bb As Byte
Dim bc As Byte
Dim bd As Byte
bc = &H10
bd = &H11
Seek #fileid, Seek(fileid) - 5
Do While 1
If Seek(fileid) = 1 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Get #fileid, , ba
If ba = bc Then
Get #fileid, , bb
If bb = bd Then
Seek #fileid, Seek(fileid) + 2
If hao = -1 Then
readfile = readfile(0, fileid, 0)
Exit Function
Else
readfile = readfile(2, fileid, hao - 1)
Exit Function
End If
Else
Seek #fileid, Seek(fileid) - 1
End If
End If
Seek #fileid, Seek(fileid) - 2
Loop
Case 3
'go boot
Seek #fileid, LOF(fileid)
readfile = readfile(0, fileid, 0)
Exit Function
Case 4
If hao = 1 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Dim isee As Integer
For isee = 1 To hao
readfile = readfile(0, fileid, 0)
Next
Exit Function
Case 5
'go N
If hao = 0 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Dim X As Integer
For X = 1 To hao * 2
readfile = readfile(0, fileid, 0)
If readfile = "seek_end" Then
Exit Function
End If
Next
readfile = readfile(0, fileid, 0)
Exit Function
Case 9
Dim stra, strb As String
stra = ""
strb = ""
stra = readfile(0, fileid, 0)
Do While 1
strb = strb & stra & Chr(16) & Chr(17) & Chr(13) & Chr(10)
stra = readfile(0, fileid, 0)
If stra = "seek_end" Then
readfile = strb
Exit Function
End If
Loop
End Select
End Function
[此贴子已经被作者于2006-5-6 15:36:14编辑过]