# include <ohana.h>
# include <gfitsio.h>

/*********************** fits write header ***********************************/
int gfits_write_header (char *filename, Header *header) {

  FILE *f;
  off_t Nbytes;
  int status;
  
  status = TRUE;

  f = fopen (filename, "w");
  if (f == (FILE *) NULL) return (FALSE);

  Nbytes = fwrite (header[0].buffer, sizeof(char), header[0].datasize, f);

  if (Nbytes != header[0].datasize) {
    status = FALSE;
  }

  fclose (f);

  return (status);
}	

/*********************** fits write header ***********************************/
int gfits_save_header (FILE *f, Header *header) {

  off_t Nbytes; 
  int status;
  
  status = TRUE;

  Nbytes = fwrite (header[0].buffer, sizeof(char), header[0].datasize, f);

  if (Nbytes != header[0].datasize) {
    status = FALSE;
  }

  return (status);
}	


int gfits_fwrite_header (FILE *f, Header *header) {

  int status;
  status = gfits_save_header (f, header);
  return (status);
}

