const
siSection = 'Memo';
siCount = 'Count';
siLine = 'Line';
…
var f: TIniFile; i: Integer;
begin
if SaveDialog1.Execute then begin
f := TIniFile.Create( SaveDialog1.FileName );
f.WriteInteger( siSection, siCount, Memo1.Lines.Count );
for i:= 1 to Memo1.Lines.Count
do f.WriteString( siSection, siLine + IntToStr(i), Memo1.Lines[i-1] );
f.Free;
end;
end;
…
var f: TIniFile; i: Integer;
begin
if OpenDialog1.Execute then begin
f := TIniFile.Create( OpenDialog1.FileName );
Memo2.Lines.Clear;
for i:= 1 to f.ReadInteger( siSection, siCount, 1 )
do Memo2.Lines.Add( f.ReadString( siSection, siLine + IntToStr(i), '' ));
f.Free;
end;
end;