C/C++ reference: http://www.cppreference.com/

Laboratory 9: Handling Variable-Length Records with Length Indicator and Formating Output

        In this lab, you will learn how to manipulate records in a file with variable-length records that have length indicators.
        You will have to jump to a certain record (using its RRN) in order to
        read it; the records begin with a length indicator which should be used
        to skip through records sequentially.
        The first record has RRN=0, the second has RRN=1, and so on.

        In addition, you will learn how to use C++ formating methods to create a report.

SOLUTION

YOUR TASK

Task:  Read the records of the file in reverse order and write them into another file by using the specified report format

SPECIFICATIONS

Record Format

XXLAST-NAME|FIRST-NAME|MONTH|DAY|YEAR|

XX = record length
|  = field separator

Example:
26Smith|James|Dec|17|1973|

Report Format

LAST NAME    FIRST NAME   MONTH DAY YEAR        <-------  HEADER
------------ ------------ ----- --- ----         <-------  HEADER
McDonald     Bill         Out   13  1978         <-------  RECORD
Spellman     Sabrina      Feb   11  1970             .
Johnson      Ashley       Dec   30  1974             .
Joe          Billy        Nov   07  1966             .
Miller       Scott        Jun   28  1972
William      John         Dec   12  1973
Shelling     Anthony      May   29  1969
Elk          Ann          Mar   06  1976
Dupont       Michel       Feb   22  1970
Smith        James        Dec   17  1973         <-------  RECORD

<----------> <----------> <---> <-> <-->
     12           12        5    3   4    (lengths in output_lengths array)