# include "fits.h"

/*********************** fits read matrix ***********************************/
int fits_read_matrix (char *filename, Matrix *matrix) {

  FILE *f;
  Header header;
  int status;

  status = fits_read_header (filename, &header);
  if (!status) {
    fprintf (stderr, "error reading header of FITS file %s\n", filename);
    return (FALSE);
  }

  f = fopen (filename, "r");
  if (f == NULL) return (FALSE);

  fseek (f, header.size, 0);
  
  status = fits_load_matrix (f, matrix, &header);

  fclose (f);

  return (status);

}

