I am afraid you are right in all counts. Of course if you are clever
you can re-use the deleted records when someone wants to add a new
record and there is a deleted slot available. If used in this way the
file gets as big as its biggest ever snapshot in time. This is what is
referred to as BLOATING. Many databses work this way. Now you could
then write a routine to burn through the first file, missing the deleted
records and create a 2nd file then re-name etc. If you run this from
time to time it is effectively a PACK function! e.g. Access,
Paradox,DBase etc etc.
regards Tony Goodrich
> -----Original Message-----
> From: Coulter, Jeremy [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, 5 July 1999 14:50
> To: Multiple recipients of list delphi
> Subject: [DUG]: Deleteing from a Binary file
>
> Hi all.
>
> I am working on a wee component at the moment that writes data to a
> wee
> flatfile db that i have defined and created.
> One of the things I would liek to do is, delete a record from the
> file.
>
> the record might be say 15 or so records into the database.
> is there any easyway to delete this record?
> I thought about doing something like having a wee flag at the begining
> of
> the record that says if the record is deleted or not.
> But the problem with this is, that the file size is still going to
> grow,
> when if a record is deleted, then the file should decrease in size.
> the only wqay I can think of doing this is, to copy everything around
> the
> record to a new file, then deleteing the old one, and renaming the new
> one
> to the old files name....but this seems cumbersom.
>
> Any Ideas that might help ??
>
> Thanks,
>
> Jeremy Coulter
> Application Developer
>
> Application Development Centre
> Compaq Computer New Zealand Ltd.
>
> Phone: 64 3 371 5724 (DD)
> Fax: 64 3 371 5744
> Cell: 021 2150435
> E-mail: [EMAIL PROTECTED]
> Private E-Mail: [EMAIL PROTECTED]
> <<Jeremy Coulter.vcf>> << File: Jeremy Coulter.vcf >>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz