Fall 2001 CSCI 333 Homework 10

This assignment is due Friday, 7 December.

The file /usr/local/csci/333/home10.dat on the CSCI Unix workstations is a 1 Mbyte file that consists of 64k 16-byte records of the following format:

struct MessLink {
  char MessText[14] ;
  unsigned short int MessNext ;

Some of these records form linked lists that run though the file home10.dat. These messages are linked by the MessNext field. The 64k records are numbered from 1 to 65,535, and the MessNext gives the record number of the next record in the list. When the MessNext field is 0, the chain of links is ended.

The MessNext field of the 0'th message of home0X.dat contains the record number of the first element of the linked list.

The MessText fields of the records contain a text message, in this case, part of sentence from the Declaration of Independence. Print the text of each record of the list and you print the message.

The assignment

As you have probably surmised by now, your task is to follow the links of the file and print the message. This is primary an assignment about doing file I/O and consequently bears some resemblance to Homework 6.

Turning in the assignment

Email the C++ source for the completed assignment to the instructor.