title: HDF5 C++ read the contents of an attribute
body: <p>I try to read the contents of an Attribute. I use C++ and the HDF5 API.
  My script looks like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #ifndef H5_NO_NAMESPACE
  #ifndef H5_NO_STD
  using std::cout;
  using std::endl;
  #endif // H5_NO_STD
  #endif
  #include "H5Cpp.h"
  #ifndef H5_NO_NAMESPACE
  using namespace H5;
  #endif
  
  const H5std_string FILE_NAME ("file.h5");
  const H5std_string GROUP_NAME_what ("here/where");
  
  int main (void)
  {
  
  
      H5File file( FILE_NAME, H5F_ACC_RDONLY );
  
      /*
       * open Group and Attribute
       */
      Group what= file.openGroup( GROUP_NAME_what );
      Attribute attr = what.openAttribute("lat");
  
  
      H5std_string test;
  
      DataType type = attr.getDataType();
      attr.read(type,test);
  
      cout &lt;&lt; test &lt;&lt; endl;
  
      return 0;
  
  }
  </code></pre>
  
  <p>what should be written in <code>test</code> is: </p>
  
  <pre><code>ATTRIBUTE "lat" {
                    DATATYPE  H5T_IEEE_F64LE
                    DATASPACE  SCALAR
                    DATA {
                    (0): 48.3515
                    }
                 }
  </code></pre>
  
  <p>but what I get is:</p>
  
  <pre><code>lÐÞþ,H@
  </code></pre>
  
  <p>Can someone tell my what I made wrong?</p>
  
  <p>Tanks a lot!!</p>