C++에서 기본적인 hdf5 데이터 세트 읽기/쓰기 작업을 시도했습니다.HDF5의 이상한 예외
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 = '@╦>ÿ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 = '@╦>ÿ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 = '@╦>ÿ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 = '@╦>ÿK', errno = 22, error message = 'Invalid argument', flags = 13, o_fl
ags = 302
major: File accessibilty
minor: Unable to open file
하지만 "abcd.h5"와 "DSET"와 같은 파일 이름과 데이터 세트 이름을 하드 코딩하는 경우, 다음, 나는 수 있어요 : 모든 데이터를 입력하면
#include "stdafx.h"
#include "h5cpp.h"
#include <iostream>
#include <conio.h>
#include <vector>
#include <string>
#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<<"Enter The Data : ";
for(int i = 0 ; i < 10 ; i++)
std::cin>>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->createDataSet(dsName, type, dSpace);
dSet.write(data, type);
std::cout << "Data Written\n";
dSet.read(dataOut, type);
std::cout<<"Data Read\n";
for(int i = 0 ; i < 10 ; i ++)
std::cout<<dataOut[i]<<"\n";
delete myGroup;
}
catch(Exception e)
{
e.printError();
}
_getch();
return 0;
}
, 나는 예외를 얻을 필요한 출력을 얻을 얻을 수 있지만, 출력 후, 나는 예외를 얻고있다 :
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
이 문제를 파악에서 저를 도와주세요.
그냥 스타일 주석 : 왜 'myGroup'에 대한 포인터를 사용합니까? 이것은 불필요합니다. – Simon