/***************************************************************
 *
 * routine read_ev: routine to extract an event information 
 * from file acquired with Pamela acquisition programs
 *
 * June 2002
 *
 ***************************************************************/
/*
 * include needed system headers
 */
#include <stdio.h>       /* include standard i/o library */
#include <stdlib.h>      /* include standard library */
#include <string.h>      /* include string library */
#include <unistd.h>      /* include unix standard library */
#include <sys/types.h>   /* */
#include <sys/stat.h>    /* */
#include <fcntl.h>       /* */
#include <errno.h>       /* error simbol definitions */
#include <time.h>        /* system time definitions */
#include <math.h>        /* math library */

void readev_(unsigned long *data, int *error, int *fd)
{
  long header;
  header = (long) malloc (sizeof(long));

  *error = 0; 
  
  *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1;

  if (*error) {
      /*      printf ("%d \n", *error);        */
      free (header);
      return;
  }

  *data = header ; 
 
  /* printf ("%d \n", *data); */

  *error = 0;
}










