Delphi Record To Stream
2021-06-19 04:05
标签:use size string begin fuser fuse RoCE click info Delphi Record To Stream 标签:use size string begin fuser fuse RoCE click info 原文地址:https://www.cnblogs.com/wissly/p/10292699.htmltype
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;
上一篇:C#常用命令
下一篇:C# 文件/文件夹压缩解压缩