How can I recover binary data from the INTDATA file using the provided C structure?

Can anyone help me in solving this i am in analysis paralysis right now cannot wrap my head around the problem


Programming Exercise

NOTE: ALL INFORMATION REQUIRED TO COMPLETE THE TASK IS INCLUDED IN THIS README FILE.

The INTDATA file contains an hex-ASCII dump of binary data, with some header
information for each block. This file was produced by extracting the binary data
from a data collection unit running an Intel CPU, and saving it in human-readable
format. The task is to write a recovery program that operates on the hex-ASCII
representation of the binary data and recovers the data correctly.

Here is a 'c' structure definition which shows, in the data block, the
positions of the items in the block:

struct flashdata
{
uint16 filename_id; // number for file
uint32 sequence_in_file; // file sequence number
uint16 number_records; // recs in block
uint16 data_length; // data length
uint16 flags; // unused presently
unsigned char compression_type; // unused presently
unsigned char spare; // unused presently
unsigned char data[2048-14]; // the data itself
};

The blocks need to have the binary data extracted from them. Then check the
block. If the filename_id is not 0002 then discard the block. If the block
has obvious errors (data_length>2048-14) then discard. Otherwise use the
data_length, number_records and data fields to extract the data records.


Record structure:

<length><flags><len2> <data.......>
file0.jpg
Was this page helpful?