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.

8 Creating and Writing to a Binary Table Extension 18<br />

pFits->pHDU().addKey("STRING",std::string(" Rope "),"trailing blank<br />

test 1 ");<br />

pFits->pHDU().addKey("STRING2",std::string("Cord"),"trailing blank test<br />

2 ");<br />

// demonstrate increaing number of rows and null values.<br />

long ignoreVal(12112);<br />

long nullNumber(-999);<br />

try<br />

{<br />

// add a TNULLn value to column 2.<br />

newTable->column(colName[1]).addNullValue(nullNumber);<br />

// test that writing new data properly expands the number of rows<br />

// in both the file]).write(planets,rows-3);<br />

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

// test the undefined value functionality. Undefineds are replaced on<br />

// disk but not in the memory copy.<br />

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

}<br />

catch (FitsException&)<br />

{<br />

// this time we’re going to ignore problems in these operations<br />

}<br />

// output header information to check that everything we did so far<br />

// hasn’t corrupted the file.<br />

std::cout pHDU() addColumn(Tstring,"Mnemonic",10," words ");<br />

newTable->column("Mnemonic").write(mnemon,1);<br />

// write the data string.<br />

newTable->writeDate();<br />

// and see if it all worked right.<br />

std::cout

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

Saved successfully!

Ooh no, something went wrong!