Restored from previous forum. Originally posted by Franco.
Code: Select all
; (c) 2001 - Franco's template - absolutely freeware
; MaxLine() works with text files
; Returns the number of lines in a text file
; Example: MaxNumberOfLines = MaxLine()
Procedure MaxLine(File)
EndPos=Lof(File)
FileSeek(File, 0)
NewPos=0
LineNumber=0
While NewPos<=EndPos
ReadString(File)
LineNumber=LineNumber+1
NewPos=Loc(File)
If NewPos=Lof(File)
Goto ExitMaxLineWhile
EndIf
Wend
ExitMaxLineWhile:
FileSeek(File, NowPos)
ProcedureReturn LineNumber
EndProcedure
Have a nice day...
Franco