Delphi Record To Stream

Posted wissly

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Delphi Record To Stream相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

adodb.stream的说明

sh Stream ripper - Radio Record / Registrare radio

Record 与 Class, Delphi有部分类改为记录了,他们是怎么释放的!

Delphi制作QQ自动登录器源码

FlinkFlink 写入 kafka 报错 Failed to send data to Kafka: Expiring 4 record(s) for 20001 ms has passed(代码

“perf_event_open”系统调用通过选项“PERF_RECORD_SAMPLE”返回的结构中的“id”和“stream_id”有啥区别?