小
小ゆ鱼ゆ儿
Unregistered / Unconfirmed
GUEST, unregistred user!
嗯,我本来的程序是这样的:
var
AStream,BStream:TMemoryStream;
begin
AStream := TMemoryStream.Create ;
BStream := TMemoryStream.Create ;
AStream.LoadFormFile('temp.txt') ;
BStream.Seek(BStream.Size ,soFromBeginning) ;
BStream.CopyFrom(AStream ,AStream.Size) ;
end;
运行正常,但是现在我需要对temp.txt进行一些更改再加入BStream,于是我加上了一个StringList,程序如下:
var
AStream,BStream:TMemoryStream;
List:TStringList;
begin
AStream := TMemoryStream.Create ;
BStream := TMemoryStream.Create ;
List := TStringList.Create ;
List.LoadFromFile('temp.txt') ;
......一些更改,还没有加就出错了
List.SaveToStream(AStream) ;
BStream.Seek(BStream.Size ,soFromBeginning) ;
BStream.CopyFrom(AStream ,AStream.Size) ;
end;
提示说“读取Stream错误”,这是为什么呢?我用AStream.SaveToFile('temp1.txt')来检查,输出的文件是完全一样的。。。
var
AStream,BStream:TMemoryStream;
begin
AStream := TMemoryStream.Create ;
BStream := TMemoryStream.Create ;
AStream.LoadFormFile('temp.txt') ;
BStream.Seek(BStream.Size ,soFromBeginning) ;
BStream.CopyFrom(AStream ,AStream.Size) ;
end;
运行正常,但是现在我需要对temp.txt进行一些更改再加入BStream,于是我加上了一个StringList,程序如下:
var
AStream,BStream:TMemoryStream;
List:TStringList;
begin
AStream := TMemoryStream.Create ;
BStream := TMemoryStream.Create ;
List := TStringList.Create ;
List.LoadFromFile('temp.txt') ;
......一些更改,还没有加就出错了
List.SaveToStream(AStream) ;
BStream.Seek(BStream.Size ,soFromBeginning) ;
BStream.CopyFrom(AStream ,AStream.Size) ;
end;
提示说“读取Stream错误”,这是为什么呢?我用AStream.SaveToFile('temp1.txt')来检查,输出的文件是完全一样的。。。