Count Lines Of Text In Txt File
hi i have text file ex. (sample.text) and i need to count lines in file and disply in memo .
I have small examp but this not work any sugestion.
function linecount(filename: string): integer;
var
f: textfile;
begin
assignfile(f,filename);
reset(f);
result:= 0;
while not eof(f) do
begin
readln(f);
inc(result);
end;
closefile(f);
end;
Thanks for help.