next up previous contents Back To Software Index
Next: Defined Symbolic Constants Up: Basic CFITSIO Conventions Previous: Routine Names

Routine Families and Datatypes

Many of the CFITSIO routines come in families which differ only in the datatype of the associated parameter(s). The datatype of these routines is indicated by the suffix of the routine name. The short routine names have a 1 or 2 character suffix (e.g., 'j' in 'ffpkyj') while the long routine names have a 4 character or longer suffix as shown in the following table:

    Long   Short  Data
    Names  Names  Type
    -----  -----  ----
    _bit     x    bit
    _byt     b    unsigned byte
    _sht     i    short integer
    _lng     j    long integer
    _usht    ui   unsigned short integer
    _ulng    uj   unsigned long integer
    _int     k    int integer
    _flt     e    real exponential floating point (float)
    _fixflt  f    real fixed-decimal format floating point (float)
    _dbl     d    double precision real floating-point (double)
    _fixdbl  g    double precision fixed-format floating point (double)
    _cmp     c    complex reals (pairs of float values)
    _dblcmp  m    double precision complex (pairs of double values)
    _log     l    logical (int)
    _str     s    character string
The `int' datatype is often 2 bytes long on IBM PC compatible systems and 4 bytes long on most other systems. The Alpha/OSF systems are unusual in that the `short', `int', and `long' integer datatypes are 2, 4, and 8 bytes long, respectively. Note that the FITS standard only supports 2 and 4 byte intergers, so FITSIO always converts between 4 and 8 bytes when reading or writing `long' integers on Alpha/OSF systems.

When dealing with the FITS byte datatype, it is important to remember that the raw values (before any scaling by the BSCALE and BZERO, or TSCALn and TZEROn keyword values) in byte arrays (BITPIX = 8) or byte columns (TFORMn = 'B') are interpreted as unsigned bytes with values ranging from 0 to 255. Some C compilers define a 'char' variable as signed, so it is important to always explicitly declare a numeric char variable as 'unsigned char'.

The complex and double precision complex datatypes are not directly supported in ANSI C, so these datatypes should be interpreted as pairs of float or double values, respectively, where the first value in each pair is the real part, and the second is the imaginary part.