I agree with @Mathias. However you also need to give it the address of test
:
double test = 0.0;
DataType type = attr.getDataType();
attr.read(type,&test);
cout << test << endl;
When you execute your program you'll get:
$ h5c++ -o test1 test1.cpp && ./test1
48.3515
$
I'm not a C++ programmer however it seems like your not doing the whole OO'nes, as in wouldn't the following make more sense?
int main (void)
{
double test = 0.0;
H5File *file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
Group *what = new Group (file->openGroup( GROUP_NAME_what ));
Attribute *attr = new Attribute(what->openAttribute("lat"));
DataType *type = new DataType(attr->getDataType());
attr->read(*type, &test);
cout << test << endl;
delete type;
delete attr;
delete what;
delete file;
return 0;
}
Yielding:
$ h5c++ -o test test.cpp &&./test
48.3515
$