Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Workshop Alex - Read/Write StringList to File

Posted on 2006-03-26
3
Medium Priority
?
354 Views
Last Modified: 2010-04-05
Workshop Alex,
I found your code on the website and it will be very useful to me. Can you help me with reading the stringlist from teh file that this code creates?

     http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21202977.html?query=save+stringlist+to+file&topics=85

Thanks



var
  I:Integer;
  Output:TextFile;
  {List:TStringList;}
begin
  AssignFile( Output, 'Filename.txt' ) );
  Rewrite( Output );
  if ( List.Count > 0 ) then begin
    for I := 0 to Pred( Pred( List.Count ) ) do begin
      WriteLn( Output, List[ I ] );
    end;
    Write( Output, List[ Pred( List.Count ) ] );
  end;
  CloseFile( Output );
end;
0
Comment
Question by:Romans
3 Comments
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 16293622
You do know that a stringlist has its own save and load from file properties yes?
This would be much quicker to use if going directly from a stringlist.
0
 

Author Comment

by:Romans
ID: 16293873
No I didn't know that. I am looking t that now ..
0
 
LVL 4

Accepted Solution

by:
tobjectpascal earned 200 total points
ID: 16298329
StringList.LoadFromFile('c:\lines.txt');
StringList.SaveToFile('c:\lines.txt');

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question