/*************************************************************** * * routine read_ev: routine to extract an event information * from file acquired with Pamela acquisition programs * * June 2002 * ***************************************************************/ /* * include needed system headers */ #include /* include standard i/o library */ #include /* include standard library */ #include /* include string library */ #include /* include unix standard library */ #include /* */ #include /* */ #include /* */ #include /* error simbol definitions */ #include /* system time definitions */ #include /* math library */ void readev_(long *data, int *error, int *fd) { long header; const char *hdr = (char *)&header; *error = 0; /* search the header */ *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1; printf ("%d \n", header); *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1; /* header >>= 32;*/ /* len = 0; */ /*printf ("%d \n", header); */ while (!(*error) && (header != 0x00defefa)) { printf ("%d \n", header); *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1; } if (*error) return; /* file read error searching the header: exit */ /* read the event number */ /* *error = read(*fd,evnum,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the event number: exit */ /* read the system time */ /* *error = read(*fd,systime,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the system time: exit */ /* read the event length */ /* *error = read(*fd,len,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the event length: exit */ /* read the packet */ /* *error = read(*fd,data,sizeof(char)*(*len)) == sizeof(char)*(*len) ? 0 : -1;*/ /* if (*error) return; /* error reading the event length: exit */ /* swab(data,data,*len);*/ /* *error = 0;*/ }