This almost always occurs because the file has just <CR>s on each line 
rather than a <CR><LF> pair.  Textpad (and many other editors) 
automatically recognize the difference and handle it correctly.  For 
some reason Borland chose not to support this in the readln function, 
but it is handled correctly in the TStringList.LoadFromFile method.... 
go figure.  I've been using a component called MapTextFile that handles 
this nicely and is much faster than the AssignFile functions.

Delphi wrote:
> I'm trying to read in a text file (I can send to anyone it's only 2K) 
> with the following code:
>
>  AssignFile(F, sPathAndFileName_);
>  Reset(F);
>  Readln(F, sInput);
>  while (Length(sInput) > 0) do begin
>    InputLine := TLLine.Create;
>    InputLine.sLine := sInput;
>    liBeginPos := Pos('<br>Text: ---(', sInput) + 14;
>    liEndPos := Pos(')---', sInput);
>    sDateTime := Copy(InputLine.sLine, liBeginPos, liEndPos - liBeginPos);
>    strlstLogs.AddObject(sDateTime, InputLine);
>    Readln(F, sInput);
>  end;
>  CloseFile(F);
>
> The problem is that Readln() reads the whole file as one line.  When I 
> load this file into Textpad it show 13 lines.  What am I missing?
>
> TIA
> Tom
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
>   

-- 
Del Texley
LIPA
Agate Resources, Inc.
(541) 484-6430


                       Confidentiality
The documents accompanying thise-mail contain information belonging to
the sender's company, which is confidential and/or legally privileged.
The information is intended only for the use of the individual or entity
named above. If you are not the intended recipient, you are hereby notified
that any disclosure, copying, distribution or the taking of any action in
reliance on the contents of this telecopied information is strictly prohibited.
If you have received this document in error, please immediately notify us by
telephone and destroy the documents received.

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to