Write a program to read and print the contents of the file /space/jones/mp5data.
This file is organized as follows:
___________ _____ index: |___________|_____| |___________|_____| a sequence of 6 byte records |___________|_____| describing the contents of |___________|_____| the remainder of the file |___________|_____| |___________|_____| _____________________________ the remainder of |_________________ ___________| the file is made |_________________|________________ of variable size |_____________________ ____________| data records, as |_____________________|____ described by the |________________________ _| index. |________________________|Each item in the index is formatted as follows:
____ ____ ____ ____ ____ ____ |____|____|____|____|____|____| |msb lsb|msb lsb| | start | count |Each data record in the remainder of the file is described by its starting byte number (32 bits) and a count of the bytes in the item (16 bits). These are stored most significant byte first. The last index entry has a count of zero, indicating the end of the index. No data record in the file is over 256 bytes long.
The data records must be written to standard output in the order of the index entries, with no characters added.
In reading the data file, use the following standard UNIX kernel calls:
open() -- to open the file lseek() -- to position the file to a particular byte read() -- to read part of the fileFor information on these kernel calls, use the man command.