
How to remove a record from a random file
Quote:
>Does anybody here know how to remove a record from Random File in VB
>physically! It seems no such command in VB to let user to remove a
>record but Add a record!
>Please reply me by E-mail! it's so urgent!
>Thanks a lot!
It's been a while since I used VB, but I think it uses the standard Microsoft
Random file type, in which case you cannot delete records from it.
Standard Random File logic employs the use of pointers embedded either in the
records or in an external (second) random file, and you "delete" records
logically by removing the pointers from the "active" chain and attaching them
to the "delete" chain.
Any "add" operation would then check the "delete" chain first for an available
record slot before grabbing more disk space.
To physically remove records from such a file, you'd have to copy all the
"active" records to a new file, erase the old file, and rename the new file.
Note that this approach can be used more effectively with BINARY files than
with RANDOM files (but why I say that is too involved for me to go into at
this point).
Hope that proves to be of some help.
--
++ ++ "Well Samwise: What do you think of the elves now?"
++ ++------------------------------------------------------