DelphiFAQ Home Search:

Reading Unix ASCII files

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

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;

Content-type: text/html

Comments:

2006-11-15, 08:33:57
hunter from China  
OH my god what are you doing? faint.....

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: