51 lines
1.3 KiB
Text
51 lines
1.3 KiB
Text
Function ReadFile(filename As String) As String
|
|
Dim As String content = ""
|
|
Dim As String linea
|
|
|
|
Dim As Integer ff = Freefile
|
|
If Open(filename For Input As #ff) = 0 Then
|
|
While Not Eof(ff)
|
|
Line Input #ff, linea
|
|
content &= linea & Chr(10)
|
|
Wend
|
|
Close #ff
|
|
Else
|
|
Print "Error opening file: " & filename
|
|
End If
|
|
|
|
Return content
|
|
End Function
|
|
|
|
Sub SplitString(text As String, delimiter As String, arr() As String)
|
|
Dim As Integer posic, cnt = 0, start = 1
|
|
|
|
Do
|
|
posic = Instr(start, text, delimiter)
|
|
If posic = 0 Then posic = Len(text) + 1
|
|
|
|
cnt += 1
|
|
Redim Preserve arr(1 To cnt)
|
|
arr(cnt) = Mid(text, start, posic - start)
|
|
|
|
start = posic + Len(delimiter)
|
|
Loop Until start > Len(text)
|
|
End Sub
|
|
|
|
Dim As String rawText = ReadFile("Traceback.txt")
|
|
Dim paragraphs() As String
|
|
SplitString(rawText, Chr(10) & Chr(10), paragraphs())
|
|
|
|
For i As Integer = 1 To Ubound(paragraphs)
|
|
Dim As String p = paragraphs(i)
|
|
|
|
If Instr(p, "SystemError") > 0 Then
|
|
Dim As Integer index = Instr(p, "Traceback (most recent call last):")
|
|
|
|
If index <> 0 Then
|
|
Print Mid(p, index)
|
|
Print "----------------"
|
|
End If
|
|
End If
|
|
Next i
|
|
|
|
Sleep
|