你好,我有这个打包的记录:
type
TMyRecord = packed record
BufSize: Word;
TargetUser:array[0..80] of char;
StreamHolder: Byte;
end;
PMyRecord = ^TMyRecord;
// 我想将 MemoryStream 保存到 StreamHolder 请看我下面的过程:
Procedure AddToRec(ATargetUser:String);
var
MyRecord: PMyRecord;
Strm:TMemoryStream;
Size: Integer;
begin
Strm:=TMemoryStream.Create;
try
Strm.LoadFromFile('myFile.dat');
Strm.position:=0;
Size:=Strm.size;
GetMem(MyRecord,Size);
ZeroMemory(MyRecord,Size);
MyRecord.BufSize := Size;
StrCopy(MyRecord.TargetUser,PChar(ATargetUser));
// here how could i copy the Strm into the StreamHolder ?
//SendMyBuffer(MyRecord,Size);
finally
Strm.free;
end;
end;
那么请问我如何将 Strm 复制到 StreamHolder ?
非常感谢