/* File: fread2.c
   Practicing with fread() 
*/

#include <stdio.h>


typedef struct {
   int hour ;
   short minute ;
   float sec ;
} time_type ;


main() {
int n, r, count = 0 ; 
time_type when ;
FILE *ifile ;

   ifile = fopen("binary", "rb") ;

   r = fread(&when, sizeof(time_type), 1, ifile) ;

   printf("hour = %d, min = %d, sec = %f\n",
     when.hour, when.minute, when.sec ) ;

   close(ifile) ;
}
