{ Open text file and read text into array substituting cr/lf's with cr's }

assign(textfile,'TEST.TXT');
{$I-} reset(textfile) {$I+} ;
file_flag:= (IOresult=0);
if file_flag then
    begin
    crflag := false; lfflag := false;
    while not eof(textfile) do
        begin
        read(textfile,ch);
        if crflag then begin lfflag:= ch=LF; crflag:=false; end
        else crflag:= ch=CR;
        if not lfflag then
            begin text_length:=text_length+1; text[text_length]:=ch; end
        else lfflag:=false;
        end;
    end;

