#include int main() { FILE* cfPtr ; int x1 ; char buffer[100] ; if ( (cfPtr = fopen( "data1.txt" , "rb" ) ) == NULL ) { printf( "File could not be opened.\n" ); } else { for( int i1=1 ; i1 <= 10 ; i1++ ) { int x2 ; fread( &x2, sizeof( x2 ), 1, cfPtr ) ; printf( "Value read was: %d\n" , x2 ) ; } fread( &buffer, 5, 1, cfPtr ) ; buffer[5] = 0 ; printf( "Value read was: %s\n" , buffer ) ; fclose ( cfPtr ); /* fclose closes the file */ } return 0; }