The CFITSIO library should be tested by building and running the testprog.c program that is included with the release. On Unix systems type:
% make testprog % testprog > testprog.lis % diff testprog.lis testprog.out % cmp testprog.fit testprog.stdOn VMS systems, (assuming cc is the name of the C compiler command), type:
$ cc testprog.c $ link testprog, cfitsio/lib, alpha$library:vaxcrtl/lib $ run testprogThe testprog program should produce a FITS file called `testprog.fit' that is identical to the `testprog.std' FITS file included with this release. The diagnostic messages (which were piped to the file testprog.lis in the Unix example) should be identical to the listing contained in the file testprog.out. The 'diff' and 'cmp' commands shown above should not report any differences in the files. (There may be some minor formatting differences, such as the presence or absence of leading zeros, or 3 digit exponents in numbers, which can be ignored).
The Fortran wrappers in CFITSIO may be tested with the testf77 program. On Unix systems the fortran compilation and link command may be called 'f77' or 'g77', depending on the system.
% f77 -o testf77 testf77.f -L. -lcfitsio -lnsl -lsocket or % f77 -f -o testf77 testf77.f -L. -lcfitsio (under SUN O/S) or % f77 -o testf77 testf77.f -Wl,-L. -lcfitsio -lm -lnsl -lsocket (HP/UX) or % g77 -o testf77 -s testf77.f -lcfitsio -lcc_dynamic -lncurses (Mac OS-X) % testf77 > testf77.lis % diff testf77.lis testf77.out % cmp testf77.fit testf77.stdOn machines running SUN O/S, Fortran programs must be compiled with the '-f' option to force double precision variables to be aligned on 8-byte boundaries to make the fortran-declared variables compatible with C. A similar compiler option may be required on other platforms. Failing to use this option may cause the program to crash on FITSIO routines that read or write double precision variables.
Also note that on some systems, the output listing of the testf77 program may differ slightly from the testf77.std template, if leading zeros are not printed by default before the decimal point when using F format.
A few other utility programs are included with CFITSIO:
speed - measures the maximum throughput (in MB per second) for writing and reading FITS files with CFITSIO listhead - lists all the header keywords in any FITS file fitscopy - copies any FITS file (especially useful in conjunction with the CFITSIO's extended input filename syntax) cookbook - a sample program that performs common read and write operations on a FITS file. iter_a, iter_b, iter_c - examples of the CFITSIO iterator routine
The first 4 of these utility programs can be compiled and linked by typing
% make program_name