[Lazarus] Appending to a binary file

Andrew Brunner andrew.t.brunner at gmail.com
Fri Dec 19 15:14:17 CET 2008


Ok, so if you want to use TFileStream you would just


FS.Seek(0,sofromEnd);
FS.Write(MyRec,SizeOf(MyRec));




On Fri, Dec 19, 2008 at 7:49 AM, Andrew Brunner
<andrew.t.brunner at gmail.com> wrote:
> 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;
>
> On Fri, Dec 19, 2008 at 7:10 AM, Dave Coventry <dgcoventry at gmail.com> wrote:
>> Can one do this?
>>
>> I know that you can append test to the end of Text files, but can you
>> tack on data to an existing file?
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>



More information about the Lazarus mailing list