Updating a file using random access


Text files are the easiest format to use and to share.Almost any computer can read from or write to a text file.



The record position is "one-based", meaning the first record position in the file is 1, the second record position is 2, and so on.To get to song number 6, you can tell your CD player to go directly to track 6, whereas on a cassette tape, you must fast-forward through the first 5 songs to get to song number 6.In the earlier days of BASIC, before the "client-server era" where RAD systems such as VB, Delphi, and Power Builder interacted with desktop and ODBC databases such as MS-Access, SQL Server, and Oracle, random access files were used as building blocks to put together data access systems that could be considered early forms of desktop databases.In the syntax formats above, reclength refers to the total length in bytes of all of the fields (variables) you define as part of a user-defined Type (UDT) structure.

The variable that you base on the UDT serves as the storage facility, or record variable, into which a record from the random file is read, or from which a record to the random file is written.

For example, the sample program for this topic will use a random access version of the employee file we used in the topics on sequential files.