Location and Read a struct from a Binary File
- Download the file "phonetic.bin
and save it in the same directory where your project stores EXE files.
- e.g., "C:\Users\solomon\source\repos\Project20190912\x64\Debug"
- This file consists of 26 records of students. For each student, 3
data items are stored:
- char[9] name
- unsigned char height
- unsigned char weight
- 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.
- 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