天
天真
Unregistered / Unconfirmed
GUEST, unregistred user!
我的意思是想把两个文本合并,a文本去掉最后18030个字节!b文本去掉前538个字节
我对流不是太懂,能帮我看看吗,欢迎指正!
filetest:tfilestream;
filetest1:tfilestream;
A,B:tmemorystream;
E:tmemorystream;
C,D : ^Byte;
I :integer;
begin
filetest:=tfilestream.Create('d:/a.txt', fmOpenRead or fmShareDenyNone);
filetest1:=tfilestream.Create('d:/b.txt', fmOpenRead or fmShareDenyNone);
A:=TMemoryStream.Create;
B:=TMemoryStream.Create;
e:=TMemoryStream.Create;
a.LoadFromStream(filetest);
b.LoadFromStream(filetest1);
filetest.free;
filetest1.free;
e.Seek(0,soFromBeginning);
e.CopyFrom(a, a.size-18030);
e.Seek(0,sofromend);
b.Seek(538,soFromBeginning);
e.CopyFrom(b,b.size-538);
e.SaveToFile('d:/mctest.doc');
showmessage(inttostr(e.size));
e.free;
a.free;
b.free;
我对流不是太懂,能帮我看看吗,欢迎指正!
filetest:tfilestream;
filetest1:tfilestream;
A,B:tmemorystream;
E:tmemorystream;
C,D : ^Byte;
I :integer;
begin
filetest:=tfilestream.Create('d:/a.txt', fmOpenRead or fmShareDenyNone);
filetest1:=tfilestream.Create('d:/b.txt', fmOpenRead or fmShareDenyNone);
A:=TMemoryStream.Create;
B:=TMemoryStream.Create;
e:=TMemoryStream.Create;
a.LoadFromStream(filetest);
b.LoadFromStream(filetest1);
filetest.free;
filetest1.free;
e.Seek(0,soFromBeginning);
e.CopyFrom(a, a.size-18030);
e.Seek(0,sofromend);
b.Seek(538,soFromBeginning);
e.CopyFrom(b,b.size-538);
e.SaveToFile('d:/mctest.doc');
showmessage(inttostr(e.size));
e.free;
a.free;
b.free;