next up previous contents FITSIO Home
Next: Image I/O Routines Up: CFITSIO Routines Previous: File-level I/O Routines   Contents

HDU-level I/O Routines:

The routines listed in this section operate on Header-Data Units (HDUs) in a file.

_______________________________________________________________
int fits_get_num_hdus(fitsfile *fptr, int *hdunum, int *status)
int fits_get_hdu_num(fitsfile *fptr,  int *hdunum)

The first routines returns the total number of HDUs in the FITS file, and the 2nd routine returns the position of the currently opened HDU in the FITS file (starting with 1, not 0).

__________________________________________________________________________
int fits_movabs_hdu(fitsfile *fptr, int hdunum, int *hdutype, int *status)
int fits_movrel_hdu(fitsfile *fptr, int nmove,  int *hdutype, int *status)

These 2 routines enable you to move to a different HDU in the file. Most of the CFITSIO functions which read or write keywords or data operate only on the currently opened HDU in the file. The first routine moves to the specified absolute HDU number in the FITS file (the first HDU = 1), whereas the second routine moves a relative number of HDUs forward or backward from the currently open HDU. The hdutype parameter returns the type of the newly opened HDU, and will be equal to one of these symbolic constant values: IMAGE_HDU, ASCII_TBL, or BINARY_TBL. hdutype may be set to NULL if it is not needed.

_________________________________________________________________
int fits_get_hdu_type(fitsfile *fptr,  int *hdutype, int *status)

Get the type of the current HDU in the FITS file: IMAGE_HDU, ASCII_TBL, or BINARY_TBL.

____________________________________________________________________
int fits_copy_hdu(fitsfile *infptr, fitsfile *outfptr, int morekeys,
                  int *status)

Copy the current HDU from the FITS file associated with infptr and append it to the end of the FITS file associated with outfptr. Space may be reserved for morekeys additional keywords in the output header.

_______________________________________________________________________
int fits_copy_header(fitsfile *infptr, fitsfile *outfptr,  int *status)

Copy all the header keywords from the current HDU associated with infptr to the current HDU associated with outfptr. If the current output HDU is not empty, then a new HDU will be appended to the output file. The output HDU will then have the identical structure as the input HDU, but will contain no data.


next up previous contents FITSIO Home
Next: Image I/O Routines Up: CFITSIO Routines Previous: File-level I/O Routines   Contents