<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>CCfits: Reading Header information from a HDU</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div> <div class="contents"> <h1><a class="anchor" id="readhead">Reading Header information from a HDU </a></h1><p>This function demonstrates selecting one HDU from the file, reading the header information and printing out the keys that have been read and the descriptions of the columns.</p> <p>The readData flag is by default false (see below for the alternative case), which means that the data in the column is not read.</p> <div class="fragment"><pre class="fragment"><span class="keywordtype">int</span> readHeader() { <span class="keyword">const</span> <span class="keywordtype">string</span> SPECTRUM(<span class="stringliteral">"SPECTRUM"</span>); <span class="comment">// read a particular HDU within the file. This call reads just the header </span> <span class="comment">// information from SPECTRUM</span> std::auto_ptr<FITS> pInfile(<span class="keyword">new</span> FITS(<span class="stringliteral">"file1.pha"</span>,Read,SPECTRUM)); <span class="comment">// define a reference for clarity. (std::auto_ptr<T>::get returns a pointer</span> ExtHDU& table = pInfile->extension(SPECTRUM); <span class="comment">// read all the keywords, excluding those associated with columns.</span> table.readAllKeys(); <span class="comment">// print the result.</span> std::cout << table << std::endl; <span class="keywordflow">return</span> 0; } </pre></div> </div> <hr size="1"/><address style="text-align: right;"><small>Generated on Wed Sep 9 11:59:41 2009 for CCfits by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>