CFITSIO can read and write FITS images or table columns containing 64-bit integer data values. This data type is not recognized in the official FITS Standard definition document, but it is likely that FITS will eventually support this data type, especially as computers that run 64-bit operating systems become more common. Support for reading and writing 64-bit integers in CFITSIO can be controlled with the #define statement at the beginning of the fitsio2.h file by setting SUPPORT_64BIT_INTEGERS to 1 (enable) or 0 (disable).
Under the convention used by CFITSIO, FITS 64-bit images have BITPIX = 64, and the 64-bit binary table columns have TFORMn = 'K'. The use of these data types on platforms where the size of a 'long' (or 'longlong') integer = 8 bytes is rather intuitive. CFITSIO will write 64-bit '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 that do not support an intrinsic 64-bit integer data type. In this case it is not possible to return the full 64 precision of the FITS data values when reading the values into a program variable. CFITSIO will still 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.