Previous: Usage Guidelines and Suggestions
Up: Usage Guidelines and Suggestions
Next: Creating a new FITS file
Previous Page: Usage Guidelines and Suggestions
Next Page: Creating a new FITS file
The following sequence of subroutine calls illustrate a simple example of reading an existing FITS file. The example programs which are distributed along with the FITSIO code (wsimple.for, rsimple.for, listhead.for) also provide useful examples of the FITSIO usage.
1. Open the file with FTOPEN. 2. Read any desired header keywords with FTGHPR or FTGKYx. 3. Read the primary data, if any, with FTGPVx or FTGPFx. 4. Repeat steps 2 and 3 until all the desired information has been read. 5. Move to another extension with FTMAHD or FTMRHD. 6. Read any extension header keywords (e.g. with FTGHTB, FTGHBN or FTGKYx) 7. Read any columns of data from the extension (e.g. with FTGCVx or FTGCFx) 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 FTCLOS.