5.7.1 Create New Table

1
Create a new ASCII or bintable table extension. If the FITS file is currently empty then a dummy primary array will be created before appending the table extension to it. The tbltype parameter defines the type of table and can have values of ASCII_TBL or BINARY_TBL. The naxis2 parameter gives the initial number of rows to be created in the table, and should normally be set = 0. CFITSIO will automatically increase the size of the table as additional rows are written. A non-zero number of rows may be specified to reserve space for that many rows, even if a fewer number of rows will be written. The tunit and extname parameters are optional and a null pointer may be given if they are not defined. The FITS Standard recommends that only letters, digits, and the underscore character be used in column names (the ttype parameter) with no embedded spaces. Trailing blank characters are not significant.

  int fits_create_tbl / ffcrtb
      (fitsfile *fptr, int tbltype, LONGLONG naxis2, int tfields, char *ttype[],
       char *tform[], char *tunit[], char *extname, int *status)

2
Copy the structure of an open table to a new table, optionally copying zero or more rows from the input table. This is useful in cases where a task will filter rows from the input before transferring to the output, so a “pristine” output table with zero rows is desired to start. The input file must be open and point to a binary table extension. The output file must be open for writing; a new extension is created with the same table structure as the input. Optionally, a range of nrows may be copied starting from firstrow, similar to fits_copy_rows(). The value nrows may be 0. Note that the first row in a table is at row = 1.

  int fits_copy_hdutab / ffcpht
      (fitsfile *infptr, fitsfile *outfptr, LONGLONG firstrow,
       LONGLONG nrows, > int *status)