title: Weird Exception in HDF5
body: <p>I was trying a basic hdf5 dataset read/write operations in C++.</p>
  
  <pre><code>#include "stdafx.h"
  #include "h5cpp.h"
  #include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  
  #ifndef H5_NO_NAMESPACE
      using namespace H5;
  #endif
  
  const H5std_string  fName("dset.h5");
  const H5std_string  dsName("dset");
  
  int main()
  {
      try
      {
          int data[10];
          int dataOut[10];
          //Exception::dontPrint();
  
          std::cout&lt;&lt;"Enter The Data : ";
          for(int i = 0 ; i &lt; 10 ; i++)
              std::cin&gt;&gt;data[i];
  
          H5File file(fName, H5F_ACC_TRUNC);
          IntType type(H5T_NATIVE_INT);
  
          Group *myGroup = new Group(file.createGroup("\\myGroup"));
  
          hsize_t dim[] = {10};
          DataSpace dSpace(1,dim);
  
          DataSet dSet = myGroup-&gt;createDataSet(dsName, type, dSpace);
          dSet.write(data, type);
  
          std::cout &lt;&lt; "Data Written\n";
          dSet.read(dataOut, type);
  
          std::cout&lt;&lt;"Data Read\n";
          for(int i = 0 ; i &lt; 10 ; i ++)
              std::cout&lt;&lt;dataOut[i]&lt;&lt;"\n";
  
          delete myGroup;
      }
      catch(Exception e)
      {
          e.printError();
      }
  
      _getch();
      return 0;
  }
  </code></pre>
  
  <p>After all the data is entered, I get exceptions:</p>
  
  <pre><code>HDF5-DIAG: Error detected in HDF5 (1.8.12) thread 0:
  #000: ..\..\src\H5F.c line 1503 in H5Fcreate(): unable to create file
  major: File accessibilty
  minor: Unable to open file
  #001: ..\..\src\H5F.c line 1285 in H5F_open(): unable to open file: time = Wed
  Feb 12 00:02:29 2014
  , name = '@╦&gt;ÿK', tent_flags = 13
  major: File accessibilty
  minor: Unable to open file
  #002: ..\..\src\H5FD.c line 987 in H5FD_open(): open failed
  major: Virtual File Layer
  minor: Unable to initialize object
  #003: ..\..\src\H5FDsec2.c line 343 in H5FD_sec2_open(): unable to open file:
  name = '@╦&gt;ÿK', errno = 22, error message = 'Invalid argument', flags = 13, o_fl
  ags = 302
  major: File accessibilty
  minor: Unable to open file
  HDF5-DIAG: Error detected in HDF5 (1.8.12) thread 0:
  #000: ..\..\src\H5F.c line 1503 in H5Fcreate(): unable to create file
  major: File accessibilty
  minor: Unable to open file
  #001: ..\..\src\H5F.c line 1285 in H5F_open(): unable to open file: time = Wed
  Feb 12 00:02:29 2014
  , name = '@╦&gt;ÿK', tent_flags = 13
  major: File accessibilty
  minor: Unable to open file
  #002: ..\..\src\H5FD.c line 987 in H5FD_open(): open failed
  major: Virtual File Layer
  minor: Unable to initialize object
  #003: ..\..\src\H5FDsec2.c line 343 in H5FD_sec2_open(): unable to open file:
  name = '@╦&gt;ÿK', errno = 22, error message = 'Invalid argument', flags = 13, o_fl
  ags = 302
  major: File accessibilty
  minor: Unable to open file
  </code></pre>
  
  <p>But if I hardcode the filename and dataset names like "abcd.h5" and "dSet", then, I am able to get to get the required output but after the output, I am getting exceptions:</p>
  
  <pre><code>HDF5-DIAG: Error detected in HDF5 (1.8.12) thread 0:
  #000: ..\..\src\H5T.c line 1765 in H5Tclose(): immutable datatype
  major: Invalid arguments to routine
  minor: Bad value
  DataType::~DataType - H5Tclose failed
  </code></pre>
  
  <p>Please, help me in figuring out this problem.</p>