Example program for file updating random access
However, if the data had been changed at all, the entire file would have to be stored back to the disk or the changes would be lost.There are some advantages and disadvantages to using a sequential file this way.With a sequential file, all records are read into memory so the disk is only accessed once.Ideally, you should keep track of the locations of deleted records so that they can be reused when new records are added.
Another way to get rid of the wasted records (if you don't want to go to the trouble of keeping track of the deleted records) is to write a program to do "Garbage Collection". 2 Garbage Collection A "Garbage Collection" program reads all undeleted records and writes them to a new file.
By Dave Kelly, Mac Tutor Editorial Board There are two types of data files that can be created and used by your MS Basic program: sequential files and random access files.