These routines read or write data values in the primary data array (i.e., the first HDU in a FITS file) or an IMAGE extension. These routines simply treat the array as a long 1-dimensional array of pixels ignoring the intrinsic dimensionality of the array as defined by the NAXISn keywords. When dealing with a 2D image, for example, the application program must calculate the pixel offset in the 1-D array that corresponds to any particular X, Y coordinate in the image. C programmers should note that the ordering of arrays in FITS files, and hence in all the CFITSIO calls, is more similar to the dimensionality of arrays in Fortran rather than C. For instance if a FITS image has NAXIS1 = 100 and NAXIS2 = 50, then a 2-D array just large enough to hold the image should be declared as array[50][100] and not as array[100][50].
The `datatype' parameter specifies the datatype of the `nulval' and `array' pointers and can have one of the following values: TBYTE, TSHORT, TUSHORT, TINT, TUINT, TLONG, TULONG, TFLOAT, TDOUBLE. Automatic data type conversion is performed if the data type of the FITS array (as defined by the BITPIX keyword) differs from that specified by 'datatype'. The data values are also automatically scaled by the BSCALE and BZERO keyword values as they are being read or written in the FITS array.
int fits_write_img / ffppr (fitsfile *fptr, int datatype, long firstelem, long nelements, DTYPE *array, int *status);
int fits_write_imgnull / ffppn (fitsfile *fptr, int datatype, long firstelem, long nelements, DTYPE *array, DTYPE *nulval, > int *status);
int fits_write_null_img / ffpprn (fitsfile *fptr, long firstelem, long nelements, > int *status)
int fits_read_img / ffgpv (fitsfile *fptr, int datatype, long firstelem, long nelements, DTYPE *nulval, > DTYPE *array, int *anynul, int *status)