Thema: Delphi record speichern

Einzelnen Beitrag anzeigen

rossmann

Registriert seit: 10. Apr 2003
Ort: Bergkamen
9 Beiträge
 
#6
  Alt 16. Apr 2003, 11:19
[B]
Ich denke so wird es gehen lesen und schreiben


[delphi]
type
TMod = record
modname : string;
moddesc : string;
modbemerkungen : string;
modversion : string[200];
modforversion : string;
author : string[200];
authormail : string;
authorpage : string;
end;

TModAction = record
cstr1 : string;
cstr2 : string;
insreturn : boolean;
datei : string;
end;



TForm1 = class(TForm)
Button1 : TButton;
Button2: TButton;
procedure Button1Click(Sender : TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;

var
Form1 : TForm1;
actions : array of TModAction;

implementation

{$R *.dfm}
////////////////////
///// SCHREIBEN
////////////////////
procedure TForm1.Button1Click(Sender : TObject);
var s : TFileStream;
x : integer;
begin
x := Sizeof(actions);
s := TFileStream.Create('c:\test.rec',fmCreate);
try
s.WriteBuffer(Actions, x);
finally
s.Free;
end;
end;

////////////////////
///// LESEN
////////////////////
procedure TForm1.Button2Click(Sender: TObject);
var s : TFileStream;
x : integer;
begin
s := TFileStream.Create('c:\test.rec',fmOpenRead);
try
x := s.Size;
s.ReadBuffer(Actions, x);
finally
s.Free;
end;
end;
  Mit Zitat antworten Zitat