码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi Record To Stream

时间:2019-01-19 20:06:37      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:use   size   string   begin   fuser   fuse   RoCE   click   info   

type
  TUserInfo = record
  sUserId,sUserName:String;
  iUserCount:integer;
end;

procedure TForm1.Button1Click(Sender: TObject);
var fStream:TMemoryStream;
  fUserRec,sUserDD:TUserInfo;
  sDataText:String;
begin
  try
    fUserRec.sUserId := UserId;
    fUserRec.sUserName := 张三峰;
    fUserRec.iUserCount := 9876;        
    fStream := TMemoryStream.Create;

    fStream.Write(fUserRec,SizeOf(TUserInfo));
    fStream.Position := 0;
    ///sDataText := StreamToBase64(fStream);
    //MyInfo(sDataText);
    MyInfo(IntToStr(fStream.Size));
    fStream.Read(sUserDD,sizeof(TUserInfo));
    MyInfo(sUserDD.sUserId);

  finally
    freeAndNil(fStream);
  end;
end;

 

Delphi Record To Stream

标签:use   size   string   begin   fuser   fuse   RoCE   click   info   

原文地址:https://www.cnblogs.com/wissly/p/10292699.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!