Example program for file updating random access

The total length of an individual record would then be 85 characters.Now decide how many individual records you expect to have in the file.The stream model of file I/O was popularized by Unix, which was developed concurrently with the C programming language itself.

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.