CFITSIO can read and write FITS images or table columns containing 64-bit integer data values. This data type is not recognized in the offical FITS Standard definition document, but it is likely that FITS will eventually support this data type, expecially as computers that run 64-bit operating systems become more common. To enable support for 64-bit integers in CFITSIO the #define statement at the beginning of the fitsio2.h file must set SUPPORT_64BIT_INTEGERS to 1. Currently it is set to 0 by default.
The FITS 64-bit images have BITPIX = 64, and the 64-bit binary table columns have TFORMn = 'K'. The use of these datatypes on platforms where the size of a 'long' integer = 8 is rather intuitive. CFITSIO will write 'long' variable values to the FITS file and read them back into 'long' variables just as one would expect. CFITSIO also supports implicit data type conversion between 64-bit integer images and columns and any other supported data type, although some loss of numerical precision or numerical overflow is likely in this case.
The situation is more difficult on 32-bit computing platforms where the size of a 'long' variable = 32. In this case there is no obvious way to return the full 64 precision of the FITS data values when reading the FITS file. CFITSIO will convert the 64-bit integer values into any other supported data type; the 64-bit double data type is probably the most useful in this case. It only provides about 52-bits of precision in the mantissa, however, so some lose of precision is possible.