Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Filestruct-description.txt Output Stage 2: Reading a binary data file and printing it out [3 marks] In this stage you will read a binary data file

image text in transcribedimage text in transcribed

Filestruct-description.txt

image text in transcribed

Output

image text in transcribed

image text in transcribed

Stage 2: Reading a binary data file and printing it out [3 marks] In this stage you will read a binary data file in a known format, storing the information into instances of a C data structure which you will then print out. This stage develops the following specific skills Reading binary data Opening and closing files Printing various data types using printf Using a simple command-line parameter Resources filestruct-description.txt: Describes the members of the C data struct which correspond to fields in the records of the data file . . input-*.bin: Sample binary input files. output-*.txt: Sample text output files corresponding to the input files. Useful Unix commands You might find the following Unix system commands helpful "more" or "less" diff od Task Write a C program that reads a file of binary data records as described in the structure description file. The program will read and print all the records in a binary data file where each record has the format described in filestruct-description.txt. You already developed code to print out a single record in stage 1, so the focus of this stage is reading a binary data file into memory The output formatting requirements for this stage are the same as in stage 1. However, it is possible that you may need to modify your record printing code it could be that your printf call worked correctly for the single initialised record in stage 1 but it may not be correct for al the data records in the files. You should check the output against the expected output using diff, and improve your printf statement in whatever way is needed to get the correct output. Your program must accept one command-line parameter which is the name of the input file The fields of the records are stored using the types specified in the data file description. The fields

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions