liczba linii w pliku

0

wiem ze moze to jest banał.

Jak dostać liczbe linii w pliku tekstowym :).

Pozdrawiam ;-)

0

function ile_lini(name: string): integer;
var
f: TextFile;
s: string;
begin
result:=0;
assignfile(f, name);
reset(f);
while not eof(f) do begin
readln(f, s);
inc(result)
end;
closefile(f)
end;

0

a oto i najgłupszy i najwolniejszy sposób:

function linii(filename:string):integer;
var m:tstringlist;
begin
m:=tstringlist.create;

if fileexists(filename) then
m.loadfromfile(filename) else m.text:='';
result:=m.count;
m.free;
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1