Registriert seit: 19. Aug 2003
294 Beiträge
Delphi 7 Professional
|
Streamproblem
14. Mär 2004, 17:48
Hallo,
wie kann ich bei folgendem Code das Record 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;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
type
TTest = record
a, b, c: integer;
end;
var
Form1: TForm1;
Stream: TMemoryStream;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var Test: TTest;
begin
Test.a := 1;
Test.b := 2;
Test.c := 3;
Stream := TMemoryStream.Create;
Stream.WriteBuffer(Test, Sizeof(Test));
end;
procedure TForm1.Button2Click(Sender: TObject);
var test2: TTest;
begin
Stream.Position := 0;
Stream.SaveToFile(' c:/hm.txt');
end;
end.
Gruß
Spurius
|
|
Zitat
|