27.01.2015 Views

CCfits - HEASARC - NASA

CCfits - HEASARC - NASA

CCfits - HEASARC - NASA

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7 Creating and Writing to an Ascii Table Extension 17<br />

121000};<br />

float density[] = { 5.1f, 5.3f, 5.52f, 3.94f, 1.33f, 0.69<br />

f};<br />

// append a new ASCII table to the fits file. Note that the user<br />

// cannot call the Ascii or Bin Table constructors directly as they<br />

// are protected.<br />

Table* newTable = pFits->addTable(hduName,rows,colName,colForm,colUnit,<br />

AsciiTbl);<br />

size_t j = 0;<br />

for ( ; j < rows; ++j) planets[j] = string(planet[j]);<br />

// Table::column(const std::string& name) returns a reference to a Column<br />

object<br />

try<br />

{<br />

newTable->column(colName[0]).write(planets,1);<br />

newTable->column(colName[1]).write(diameter,rows,1);<br />

newTable->column(colName[2]).write(density,rows,1);<br />

}<br />

catch (FitsException&)<br />

{<br />

// ExtHDU::column could in principle throw a NoSuchColumn exception,<br />

// or some other fits error may ensue.<br />

std::cerr

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!