Location and Read a struct from a Binary File

  1. Download the file "phonetic.bin and save it in the same directory where your project stores EXE files.
  2. This file consists of 26 records of students. For each student, 3 data items are stored:
    1. char[9] name
    2. unsigned char height
    3. unsigned char weight
  3. Write a program so that the user can input an index between 0 and 25, and your program will locate the corresponding record and print out the record.
  4. Note: If you store the file in another directory, you must specify the full pathname such as "C:\\Users\\solomon\\Downloads". Be sure to escape a backslash ('\'). Otherwise the Windows operating system may complain that the file cannot be found.

The program may run as follows:

? 0
Alfa 187 54