next up previous contents Back To Software Index
Next: Keyword I/O Routines Up: Basic Interface Routines Previous: Basic Interface Routines

File I/O Routines

CFITSIO uses a C structure (as defined in fitsio.h) to store all the relevant parameters about the format of an opened FITS file. Application programs must first declare a pointer to this structure (which is named 'fitsfile') for each FITS file that is opened. The value of the pointer is defined by the call to open or create the FITS file and then the pointer must be passed as the first argument to all the other CFITSIO routines that read or write the FITS file. The memory that is allocated for the fitsfile structure is freed when the FITS file is closed. Application programs must not directly read or write information in this fitsfile structure because the definition of the structure may change in future versions of CFITSIO.

1
Open an existing FITS file with readonly or readwrite access. The iomode parameter has allowed symbolic constant values of READONLY or READWRITE.

  int fits_open_file / ffopen
      (fitsfile **fptr, const char *filename, int iomode, > int *status)

2
Open and initialize a new empty FITS file

  int fits_create_file / ffinit
      (fitsfile **fptr, const char *filename, > int *status)

3
Close a previously opened FITS file.

  int fits_close_file / ffclos
      (fitsfile *fptr, > int *status)

4
Move to a specified (absolute) HDU in the FITS file. When a FITS file is first opened or created it is automatically positioned to the first HDU (the primary array) in the file which has hdunum = 1.

  int fits_movabs_hdu / ffmahd
      (fitsfile *fptr, int hdunum, > int *hdutype, int *status)

5
Create a new primary array if a new empty FITS file has just been created, otherwise append a new IMAGE extension following the current HDU. Refer to Chapter 9 for a list of the pre-defined bitpix values.

  int fits_create_img / ffcrim
      ( fitsfile *fptr, int bitpix, int naxis, long *naxes, > int *status)

6
Create (append) a new table extension following the current HDU. The type of table is specified by the tbltype parameter which can have symbolic constant values of ASCII_TBL or BINARY_TBL. See Chapter 9 for a list of the allowed values for the tform parameter.

  int fits_create_tbl / ffcrtb
      (fitsfile *fptr, int tbltype, long naxis2, int tfields, char **ttype,
       char **tform, char **tunit, char *extname, int *status)



next up previous contents Back To Software Index
Next: Keyword I/O Routines Up: Basic Interface Routines Previous: Basic Interface Routines