Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!gitpyr!mlw From: mlw@pyr.gatech.EDU (Michael Williams) Newsgroups: comp.lang.pascal Subject: Re: Deleting records from TYPED file Summary: Use "truncate" Keywords: turbo pascal Message-ID: <9094@pyr.gatech.EDU> Date: 31 Aug 89 00:20:52 GMT References: <833@cbnewse.ATT.COM> Reply-To: mlw@pyr.UUCP (Michael Williams) Distribution: usa Organization: Georgia Institute of Technology Lines: 20 In article <833@cbnewse.ATT.COM> rtf1@cbnewse.ATT.COM (richard.t.ferber) writes: > >I am writing a simple database program in Turbo Pascal (version 5) that >uses a TYPED file to store data records. One of the basic operations I >want the program to do is to delete records in the file (along with add, >update, etc.). It depends on how you are storing your records. If you are trying to keep them in some kind of order, it will be necessary to 'slide' them all down one and call truncate at the last position in the file. Otherwise, you could just swap the last record for the one to be deleted, and then do the truncate. Another approach is to have a boolean 'used' in each record to simply mark deleted ones, taking care of the actual deletion at a later time to improve efficiency. Hope this helps ... -- Michael Williams Georgia Insitute of Technology, Atlanta Georgia, 30332 uucp: ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!mlw ARPA: mlw@pyr.gatech.edu