Code: Select all
If ReadFile(0, "test.txt")
bom = ReadStringFormat(0)
Size.q = Lof(0)
If Size > 0
*p = AllocateMemory(Size + 2)
If *p
ReadData(0, *p, Size)
FreeMemory(*p)
EndIf
EndIf
CloseFile(0)
EndIf
lineCount = CountString(content$, #LF$) + 1
count_time = ElapsedMilliseconds()
Dim lines.s(lineCount)
*ptr.Character = @content$
line$ = ""
index = 0
While *ptr\c
If *ptr\c = #LF
lines(index) = line$
index + 1
line$ = ""
ElseIf *ptr\c <> #CR
line$ + Chr(*ptr\c)
EndIf
*ptr + SizeOf(Character)
Wend
If line$ <> ""
lines(index) = line$
EndIf
If index >= 30000
Debug("line = " + lines(3))
EndIf