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

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

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

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

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

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

  fclose (f);

  return (status);
}	

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

  int Nbytes, status;
  
  status = TRUE;

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

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

  return (status);
}	


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

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

