next up previous contents Back To Software Index
Next: Data Scaling Up: Basic CFITSIO Conventions Previous: Character Strings

Implicit Data Type Conversion

Many of the CFITSIO data I/O routines have the ability to perform implicit data type conversion. This means that the data type of the routine parameter does not need to be the same as the data type of the value in the FITS file. More specifically, the implicit data type conversion will be performed for numerical data types when reading a FITS header keyword value and when reading or writing values to or from the primary array or a table column. CFITSIO returns status = NUM_OVERFLOW (412) if the converted data value exceeds the range of the output data type. Data type conversion is not allowed when reading or writing string (s), logical (l), complex (c), or double complex (m) data types.

One feature of the CFITSIO routines is that they can operate on a `X' (bit) column in a binary table as though it were a `B' (byte) column. For example a `11X' datatype column can be interpreted the same as a `2B' column (i.e., 2 unsigned 8-bit bytes). In some instances, it can be more efficient to read and write whole bytes at a time, rather than reading or writing each individual bit (with the ffgcx and ffpclx routines).