Registriert seit: 19. Aug 2003
294 Beiträge
Delphi 7 Professional
|
Record aus stream auslesen
24. Apr 2004, 18:19
Hallo,
wie kann ich in folgendem Code das Record 'Test2' mit den Daten aus dem Stream füllen?
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
TTest=record
a,b,c: String;
end;
var
Form1: TForm1;
Test: TTest;
TestStream: TMemoryStream;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Test.a := ' a';
Test.b := ' b';
Test.c := ' c';
TestStream := TMemoryStream.Create;
TestStream. Write(Test,sizeof(Test));
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
TestStream.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
Var Test2: TTest;
begin
//Was muss ich hier schreiben, um das ecord Test2 mit Daten zu füllen?
end;
end.
Gruß
Spurius
|
|
Zitat
|