Lecture 7 - Structures and Files
Back to Previous Lecture
Up to Main Page
Forward to Next Lecture
Using Structures
The program
getinfo.c
extends the program we have written in previous lectures.
The customer information is stored in a structure.
The header file,
getinfo.h
defines a structure that contains a customer ID,
name fields (first and last), and a balance.
The program gets this information from the user and stores it
in an array of customers.
Saving Information in Files
The program
save.c extends the getinfo program.
When the user is done entering information, it is saved in a text
file using Text I/O.
The next time the program runs, the user can read that file
to load the array of customer information.
They may then add new entries and save again.
Building an Index File
The program
index.c
extends the previous program save.c
by adding an index for the file.
A structure is defined in
getinfo.h
for the index file.
It consists of the custmer ID and the starting location in the file
for that record.
In the next lecture,
we will use pointers to extend this program
and make an editor.
Back to Previous Lecture
Up to Main Page
Forward to Next Lecture