next up previous contents Back To Software Index
Next: Creating a new Up: Programming Guidelines Previous: Programming Guidelines

Reading an existing FITS file

The following sequence of routine calls illustrate a simple example of reading an existing FITS file.

 1. Open the file with fits_open_file / ffopen.
 2. Read any desired header keywords with fits_read_key / ffgky.
 3. Read the primary data, if any, with fits_read_img / ffgpv.
 4. Repeat steps 2 and 3 until all the desired information has been read.
 5. Move to another extension with fits_movabs_hdu / ffmahd.
 6. Read any extension header keywords with fits_read_key / ffgky.
 7. Read any table column of data with fits_read_col / ffgcv.
 8. Repeat steps 6 and 7 until all the information has been read.
 9. Repeat steps 5 through 8 for any other extensions.
10. Close the file with fits_close_file / ffclos.