[Lazarus] Appending to a binary file
Dave Coventry
dgcoventry at gmail.com
Sat Dec 20 23:13:44 CET 2008
Thanks Andrew.
In future I will look at using filestreams rather than go down the
AssignFile route.
2008/12/19 Andrew Brunner <andrew.t.brunner at gmail.com>:
> 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
>>>
>>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
More information about the Lazarus
mailing list