Subj : Re: Deleting a record
To   : Sean Dennis
From : Scott Adams
Date : Sat Oct 01 2005 04:33 am

-=> Quoting Sean Dennis to All <=-


SD> I'm working on a new BBS door for my system and I need it to be able
SD> to delete a record from a file.  This is a typed file and only
SD> contains five fields for each record.  I'm not wanting to have to read
SD> the file, remove the one record, then rewrite the file again (kinda
SD> the long way around).  Any suggestions?

       Theres no correct or easy way.  In fact theres dozens
       of ways to handle this.  Some as complex like B-Trees
       and such.  Some as simple as sorting/record management
       routines.  But since its a simple door.  You could simply
       locate the record (SEEK) then use some code like for
       the header or stringer make it -1 or NULL or something.
       Then when the BBS closes or does maintenance at night
       It can then rewrite the file and clean out the mess.
       Course since its only 5 fields and likely only a dozen
       or so data for players?  Then likely either way is
       fast and simple.  But I'm sure by now folks have given
       suggestions.

       Opps. Forgot.  At the maintenance or close.  Simply
       read each rocord as you suggest. Skip those with the
       delete attribute (-1/NULL/"DELETE"/etc.) and bam
       its done.

... Mister Garibaldi !!!!!   I Knoooooww....
--- Fringe BBS
* Origin: EWOG II - The Fringe - 904-733-1721 (1:112/91)