/* * cfg_rd.c * Creaion date : Nov 14 2000 * Author : Y.Nakaune */ #include #include #include #include "daq.h" /*----------------------------------------------------------- read_cfg Read CFG from STDIN ----------------------------------------------------------*/ int read_cfg( Cfg_adc *adc, Cfg_tmc *tmc, FILE *fp ) { int cfg_data_size; if ( read_flag( fp ) != CFG_FLG ) { perror( "CFG wrong flag" ); return -1; } if ( fread( &cfg_data_size, 1, sizeof(int), fp ) != sizeof(int) ) { perror( "read_cfg : cfg_data_size" ); return -1; } if ( fread( adc, 1, sizeof(Cfg_adc), fp ) != sizeof(Cfg_adc) ) { perror( "read_cfg : ADC" ); return -1; } if ( fread( tmc, 1, sizeof(Cfg_tmc), fp ) != sizeof(Cfg_tmc) ) { perror( "read_cfg : TMC" ); return -1; } if ( read_flag( fp ) != CFG_END_FLG ) { perror( "CFG_END wrong flag" ); return -1; } return 0; } /* End of File */