H
hlfysj
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
TargetFile: string;
StreamFile: TFileStream;
StreamMem: TMemoryStream;
begin
TargetFile := 'C:/setfile.exe';
StreamFile := TFileStream.Create(TargetFile, fmOpenRead or fmShareExclusive);
StreamMem := TMemoryStream.Create;
Memo1.Lines.SaveToStream(StreamMem);
StreamMem.Position := 0;
StreamFile.Seek(0, soFromEnd);
StreamFile.CopyFrom(StreamMem, StreamMem.Size);
... ...
end;
我的目的是想将 内存流:StreamMem 中的内容,追加到 文件流:StreamFile 中去
其中,memo1中有内容,在运行到 StreamFile.CopyFrom(StreamMem, StreamMem.Size);的时候,报错:Stream write error,是怎么回事啊?请高手指点一下,是delphi7,
var
TargetFile: string;
StreamFile: TFileStream;
StreamMem: TMemoryStream;
begin
TargetFile := 'C:/setfile.exe';
StreamFile := TFileStream.Create(TargetFile, fmOpenRead or fmShareExclusive);
StreamMem := TMemoryStream.Create;
Memo1.Lines.SaveToStream(StreamMem);
StreamMem.Position := 0;
StreamFile.Seek(0, soFromEnd);
StreamFile.CopyFrom(StreamMem, StreamMem.Size);
... ...
end;
我的目的是想将 内存流:StreamMem 中的内容,追加到 文件流:StreamFile 中去
其中,memo1中有内容,在运行到 StreamFile.CopyFrom(StreamMem, StreamMem.Size);的时候,报错:Stream write error,是怎么回事啊?请高手指点一下,是delphi7,