procedure GetFileLines(const FileName: string; const LineStart, LineEnd: integer; Output: TStrings);
var N, St, En, CpC: integer;
Input: TStringList;
begin
Output.BeginUpdate;
try
Input := TStringList.Create;
try
Input.LoadFromFile(FileName);
St := LineStart;
En := LineEnd;
if St < 0 then
St := 0;
if En > (Input.Count-1) then
En := Input.Count-1;
Cpc := En-St;
if Cpc = (Input.Count-1) then
Output.Assign(Input)
else
for N := St to En do
Output.Add(Input[N]);
finally
Input.Free;
end;
finally
Output.EndUpdate;
end;
end;