Strategy For Storing Records In Plaintext Files

Introduction

Previously we have seen an implementation for a library catalog ( Mini IA Example – A library catalog). That implementation used binary files.

In this class video, we anticipate the scenario where will upgrade the library catalog to store information about people. We explore this implementation using plain text files. Plain text has the advantage that the datafile is easily viewable and editable.

Both examples use the strategy to load ALL DATA AT THE START of the program. Whenever any new data is added to the system, we save all data in structure arrays by calling our save() functions which OVERWRITE the older files.

In real world practice, overwriting files on every data addition would not be as efficient , however this strategy is the easiest to manage at our introductory level. Other strategies appends the data to the end of the file which involve testing for the end of file or managing sentinel file values.

See the Video Below:

Update:

2022-01-24 : Added introduction.

© 2021  Vedesh Kungebeharry. All rights reserved. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s