How can I determine the number of lines in a file

Blitz3D Forums/Blitz3D Beginners Area/How can I determine the number of lines in a file

zortzblatz(Posted 2009) [#1]
Is there a command to do it for me in b3d?


Matty(Posted 2009) [#2]
function countlinesinfile(filename$)
infile=readfile(filename$)
if infile<>0 then
	while(not(eof(infile)))
		readline(infile)
		linecount=linecount+1
	wend
closefile infile
endif

return linecount
end function