unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
txx = record
s :string;
a :string;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
s :Tmemorystream;
aa :txx;
bb :txx;
begin
aa.a :='aaaaaaaa';
aa.s :='ssssssss';
s :=Tmemorystream.Create;
s.WriteBuffer(aa,sizeof(aa));
//这里以下可以在另一个机器理处理
s.Position :=0;
s.ReadBuffer(bb,sizeof(bb));
showmessage(bb.a+#13+bb.s);
s.Free;
end;
end.