一、TMemoryStream数据写入到字符串里
var lvStream:TMemoryStream; s:AnsiString; p: PAnsiChar; begin lvStream:= TMemoryStream( pvObject); GetMem(p, lvStream.Size + 1); FillChar(p^, lvStream.Size, 0); Move(lvStream.Memory^,p^,lvStream.Size); s:=p; FreeMem(p);
二、字符串写入到TMemoryStream
var lvStream:TMemoryStream; s:AnsiString; begin s:=‘abcdefghjkimoop‘; lvStream.Write(s[1], Length(s)); lvStream.Position := 0; end;