DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Reading Unix ASCII files

Do you need to read ASCII files that originate from a UNIX system? While DOS/ Windows environments separate lines with a #10#13 combination (^J^M), in UNIX systems only a #10 is inserted.

The regular Readln() does not recognize these line breaks.

A quick-and-dirty solution is loading the file into a TStringList. The TStringList.LoadFromFile() method will break up the lines - see below:

with TStringlist.Create do
 begin
   LoadFromFile(myfile);
   SaveToFile(myfile);
   Free; // don't forget to free the object
 end;
 

Generated 8:01:38 on Sep 21, 2018