S
shuiwen
Unregistered / Unconfirmed
GUEST, unregistred user!
我用memoryStream实现向richedit中添加数据,并向保存原来的数据,所以想到合并流文件的方法,下边的方法为啥不能实现?
var
s_RichEdit1: TMemoryStream;
s_RichEdit2,newstream : TMemoryStream;
begin
s_RichEdit1 := TMemoryStream.Create;
s_RichEdit2 := TMemoryStream.Create;
newstream := TMemoryStream.Create;
RichEdit1.Lines.SaveToStream(s_RichEdit1);//保存流1
RichEdit2.Lines.SaveToStream(s_RichEdit2);//保存流2
s_RichEdit1.Position:=0;
newstream.CopyFrom(s_RichEdit1, s_RichEdit1.Size);
s_RichEdit2.Position:=0;
newstream.CopyFrom(s_RichEdit2,s_RichEdit2.size);
newstream.Position := 0;
RichEdit3.Lines.Clear;
RichEdit3.Lines.LoadFromStream(newstream);
为什么最后RicheEdit3里显示只是RicheEdit1的内容?流合并有问题吗?请指点。
var
s_RichEdit1: TMemoryStream;
s_RichEdit2,newstream : TMemoryStream;
begin
s_RichEdit1 := TMemoryStream.Create;
s_RichEdit2 := TMemoryStream.Create;
newstream := TMemoryStream.Create;
RichEdit1.Lines.SaveToStream(s_RichEdit1);//保存流1
RichEdit2.Lines.SaveToStream(s_RichEdit2);//保存流2
s_RichEdit1.Position:=0;
newstream.CopyFrom(s_RichEdit1, s_RichEdit1.Size);
s_RichEdit2.Position:=0;
newstream.CopyFrom(s_RichEdit2,s_RichEdit2.size);
newstream.Position := 0;
RichEdit3.Lines.Clear;
RichEdit3.Lines.LoadFromStream(newstream);
为什么最后RicheEdit3里显示只是RicheEdit1的内容?流合并有问题吗?请指点。