EECS 2031 - Lab 12

This question builds on the program you prepared for Lab 11.

In fact, for this lab question, there is no new functionality to implement. Instead, you will be required to make some changes to the internal structure of your program. These changes are:

  1. The facts read from the database file must be stored internally, i.e. you must allocate memory, and save the facts read there. In other words, the printdb must not reopen the database file. It will simply print the information stored by setdb.
  2. There is no longer a guarantee that any string entered by the user will be at most 128 characters long. In fact, the user may enter arbitrarily large strings.
  3. There is no longer a guarantee that the database file will contain at most 128 facts. In fact, it may be arbitrarily large.
  4. There is also no guarantee about the length of any relation name or entity name, they can be arbitrarily large.
  5. Your program must try to preserve memory as much as possible, i.e. allocate just enough memory for its needs.

What to do