2635A
Users Manual

F-8

/* Set timestamp */
scan->bcd_hours = *file_data++;
scan->bcd_minutes = *file_data++;
scan->bcd_seconds = *file_data++;
scan->bcd_month = *file_data++;
scan->bcd_day = *file_data++;
scan->bcd_year = *file_data++;
/* Get digital I/O and totalizer values */
scan->dout = *file_data++;
scan->dio = *file_data++;
file_data += convert_float(&scan->total, file_data);
/* Get measurement for each non-off channel in this scan */
for (index=0; index < max_index; index++) {
/* Convert index to channel */
ch = index_to_chan[index];
/* Read this channel’s scan data */
file_data += convert_float(&scan->meas[ch], file_data);
}
}
Using the above routines to decode the configuration of a data file and get the contentsof the first scan record will require something like the following:
char * file = “DAT00.HYD”;
int fd;
unsigned char buf[730];
int record_size;
/* Open the binary data file name pointed to by “file” */
fd = open(file, (O_RDONLY | O_BINARY));
/* Read and interpret the configuration header in the file */
read(fd, buf, 730);
record_size = convert_config(buf);
/* Read and convert the scan measurements */
read(fd, buf, record_size);
convert_scan_record(buf, &scan);