Noch eine Frage
Habe eben diesen Post gefunden:
http://www.delphipraxis.net/107884-m...eichern-2.html
Bietet TReader, TWriter vorteile gegenüber meiner gefundenn Lösung?
Delphi-Quellcode:
procedure TForm1.ButtonLadenClick(Sender: TObject);
Var Stream:TFilestream;
begin
Stream:=TFileStream.Create('D:\TestStream',fmOpenRead or fmShareDenyNone);
try
//TReader objekt erstellen und Daten aus den Stream laden
with TReader.create(Stream,1024) do
try
Memo1.Text := ReadString;
Edit1.Text := ReadString;
SpinEdit1.Value := ReadInteger;
CheckBox1.Checked := ReadBoolean;
finally
free;
end;
finally
Stream.free;
end;
end;
Delphi-Quellcode:
procedure TForm1.ButtonSpeichernClick(Sender: TObject);
Var Stream:TFilestream;
begin
Stream:=TFileStream.Create('D:\TestStream',fmcreate);
try
//TWriter objekt erstellen und Daten in den Stream speichern
with TWriter.create(Stream,1024) do
try
WriteString(Memo1.Text);
WriteString(Edit1.Text);
WriteInteger(SpinEdit1.Value);
WriteBoolean(CheckBox1.Checked);
finally
free;
end;
finally
Stream.free;
end;
end;