Respuesta :

Answer:

To read a record from binary file in C++ use read method.

Syntax: ifstream& write(const char*, int);

Explanation:

Algorithm:

Begin

  Create a structure Student to declare variables.

  Open binary file to write.

  Check if any error occurs in file opening.

  Initialize the variables with data.

  If file open successfully, write the binary data using write method.

     Close the file for writing.

  Open the binary file to read.

  Check if any error occurs in file opening.

  If file open successfully, read the binary data file using read method.

     Close the file for reading.

  Check if any error occurs

  Print the data.

End