Andrew (or anyone else), in the example you provided below, you
instantiate the Filestream:
FS:=TFileStream.Create(sFileName, fmshareDenyWrite);
after which you use a try...finally block to write data to the file
Try
FS.Seek(0,soFromEnd);
FS.WriteBuffer(sBuffer[1],iLength);
Finally
FreeAndNil(FS):
end;
My question is: Does the FreeAndNil line free the stream? If I want to
write again to the file, don't I need to instantiate the FS
TFileStream object again using TFileStream.Create?
2008/12/19 Andrew Brunner <[email protected]>:
> procedure Append();
> var
> sBuffer:string;
> iLength:integer;
> begin
>
> sBuffer:='My Appended String'#13#10;
> iLength:=Length(sBuffer);
>
> FS:=TFileStream.Create(sFileName, fmshareDenyWrite);
> Try
> FS.Seek(0,soFromEnd);
> FS.WriteBuffer(sBuffer[1],iLength);
> Finally
> FreeAndNil(FS):
> end;
> end;
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus