/* Fitsy FITS routines to work with the data portion of a FITS file. */ #include #include "fitsy.h" /* Skip over the data part of a FITS header data unit. If the file is seekable and the #ofile file pointer is #NULL or nfile is 0, the data are skipped with an #fseek(). If the #ofile file pointer is #NULL no data is written. */ #define NBLOCK 500 off_t ft_dataskip(ifile, fits, ofiles, nofile) File ifile; /* File pointer to read FITS data from. */ FITSHead fits; /* FITS header associated with data. */ File* ofiles; /* File pointers to write data to. */ int nofile; /* number of files */ { int i; int blocks; char block[FT_BLOCK * NBLOCK]; off_t pos=0; if ( ifile == NULL ) return pos; if ( fits == NULL ) return pos; if ( ft_seek(fits) != -1 && (!ofiles || !nofile) ) { if ( ft_databytes(fits) ){ pos = ftSeek(ifile, ft_databloks(fits) * FT_BLOCK, 1); return pos; } } if ( ft_databytes(fits) ) { for ( blocks = ft_databloks(fits); blocks > NBLOCK; blocks -= NBLOCK ) { ftRead(ifile, block, 1, FT_BLOCK*NBLOCK); for(i=0; idata, 0) != -1; }