# 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 = fseek (f, 0, 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) {
  
  int Nbytes;
  
  Nbytes = fwrite (header[0].buffer, sizeof(char), header[0].size, f);

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


