Machines have far more file storage space than memory space.  Because of this, applications will only load in resources that are necessary given the context. A game developer has written creature data to a binary file given the data format below. Your task is to create a program that only loads the creatures of a requested zone. Your program should allocate memory for the data ONLY when it is requested. Once loaded, display the data as shown below.

Requirements

•The creature struct should be declared in a header file with a header guard. Any functions created must have a declaration in the same header file.

•Accept two command-line arguments for the file name and requested zone.

•Search through the file and allocate memory for each creature that is in the requested zone. The creatures should be loaded in an array that is dynamically allocated as well.

•Once the end of the file is reached, print out the creatures found.

•Use the file creatures.db on Canvas to test your program. There are only 3zones (1, 2, 3) in the file.

Data Format

•long size

•int zone

•int cr

•int ac

•int hp

•char *name

Example Output

$ ./read_creature c.db 3

Name: Adult Bronze Dragon

CR: 15

HP: 212

AC: 19

Zone: 3

Name: Adult Red Dragon

CR: 17

HP: 256

AC: 19

Zone: 3

 

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!