Delphi TMemoryStream写入到字符串和字符串写入到流

一、TMemoryStream数据写入到字符串里

var
lvStream:TMemoryStream;
s:AnsiString;
p: PAnsiChar;
begin
lvStream:= TMemoryStream( pvObject);
GetMem(p, lvStream.Size + );
FillChar(p^, lvStream.Size, );
Move(lvStream.Memory^,p^,lvStream.Size);
s:=p;
FreeMem(p);

二、字符串写入到TMemoryStream

var
lvStream:TMemoryStream;
s:AnsiString;
begin
s:='abcdefghjkimoop';
lvStream.Write(s[], Length(s)); lvStream.Position := ;
end;
上一篇:Vue router 的使用--初级


下一篇:64位win7安装jdk和eclipse