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

/*********************** fits write header *********************************/
int gfits_write_Theader (char *filename, Header *header) {
  
  FILE *f;
  int status;
  
  status = TRUE;
  
  f = fopen (filename, "a+");
  if (f == (FILE *) NULL) return (FALSE);
  
  status = fseeko (f, 0LL, SEEK_END);  /* write header to end of file! */
  status = gfits_fwrite_Theader (f, header);

  fclose (f);
  return (status);
}	

/*********************** fits write header *********************************/
int gfits_fwrite_Theader (FILE *f, Header *header) {
  
  off_t Nbytes;
  
  Nbytes = fwrite (header[0].buffer, sizeof(char), header[0].datasize, f);

  if (Nbytes != header[0].datasize) return (FALSE);
  return (TRUE);
}	


