CSci351 Introduction to File Processing: Homework 2
Due date: Friday, February 15, 2008 in class
Each homework may have a different weight, which depends on its level of difficulty.
Absolutely no copying others' work
- Rewrite the extraction(>>) operator of the file
readstr.cpp
of Figure 4.4 (Page 124) in textbook, so that it uses the following field representations: (70%)
- Method 1, fixed length fields.
- Method 2, fields with length indicators.
- Method 4, fields with keyword tags.
- Suppose you need to keep a file in which every record has both fixed- and variable-length fields.
For example, suppose you want to create a file of employee records, using fixed-length fields for each employee's ID (primary key), sex, birth date, and department, and using variable length fields for each name and address.
(30%)
- What advantages might there be to using such a structure?
- Should we put the variable-length portion first or last?
- Either approach is possible; how can each be implemented?