Function GETLINE(ByVal FILEPATH As String, ByVal STARTPOS As Long) As String
Dim all As String, mybyte() As Byte, TEMPSTART As Long, TEMPLEN As Long
Open FILEPATH For Binary As #1
ReDim mybyte(LOF(1))
Get #1, , mybyte
Close #1
all = StrConv(mybyte, vbUnicode)
Erase mybyte
TEMPSTART = InStr(STARTPOS, all, vbCrLf)
TEMPLEN = InStr(STEMPSTART, all, vbCrLf) - TEMPSTART
GETLINE = Trim(Mid(all, TEMPSTART, TEMPLEN))
all = ""
End Function
Dim all As String, mybyte() As Byte
Open "c:\aaa.txt" For Binary As #1
ReDim mybyte(LOF(1))
Get #1, , mybyte
Close #1
all = StrConv(mybyte, vbUnicode)
MsgBox all '第二题
x = Split(all, "<<<<")
For i = 0 To UBound(x) - 1
If InStr(x(i), "<<<") > 0 Then Debug.Print Right(x(i), Len(x(i)) - InStrRev(x(i), "<<<") - 2) '第一题
Next
End Sub
Private Sub Form_Load()
Open "c:\aaa.txt" For Binary As #1
Put #1, , "123<<<45678<<<<sadadgh<<<5879346897203<<<<89843543<<<3432jfdf<<<<2424"
Close #1
End Sub