RosettaCodeData/Task/Text-processing-Max-licenses-in-use/FreeBASIC/text-processing-max-licenses-in-use.basic
2023-07-01 13:44:08 -04:00

25 lines
594 B
Text

Const CRLF = Chr(13) & Chr(10)
Dim As String currline, maxtime
Dim As Integer counter = 0, max = 0
Dim As String filename = "mlijobs.txt"
Open filename For Input As #1
While Not Eof(1)
Line Input #1, currline
If Mid(currline,9,3) = "OUT" Then
counter += 1
Else
counter -= 1
End If
If counter > max Then
max = counter
maxtime = Mid(currline,15,19)
Elseif counter = max Then
maxtime &= CRLF & Mid(currline,15,19)
End If
Wend
Print Str(max); " license(s) used at ;"; CRLF; maxtime
Close #1
Print !"\nPress ENTER to exit"
Sleep