diff --git a/test cases/frameworks/25 hdf5/main.cpp b/test cases/frameworks/25 hdf5/main.cpp index 477e76b66..9c7f7bfb6 100644 --- a/test cases/frameworks/25 hdf5/main.cpp +++ b/test cases/frameworks/25 hdf5/main.cpp @@ -1,29 +1,19 @@ #include -#include "hdf5.h" +#include "H5Cpp.h" int main(void) { -herr_t ier; unsigned maj, min, rel; -ier = H5open(); -if (ier) { - std::cerr << "Unable to initialize HDF5: " << ier << std::endl; +try { + H5::H5Library::open(); + H5::H5Library::getLibVersion(maj, min, rel); + std::cout << "C++ HDF5 version " << maj << "." << min << "." << rel << std::endl; + H5::H5Library::close(); + return EXIT_SUCCESS; +} catch (H5::LibraryIException &e) { + std::cerr << "Exception caught from HDF5: " << e.getDetailMsg() << std::endl; return EXIT_FAILURE; } - -ier = H5get_libversion(&maj, &min, &rel); -if (ier) { - std::cerr << "HDF5 did not initialize!" << std::endl; - return EXIT_FAILURE; -} -std::cout << "C++ HDF5 version " << maj << "." << min << "." << rel << std::endl; - -ier = H5close(); -if (ier) { - std::cerr << "Unable to close HDF5: " << ier << std::endl; - return EXIT_FAILURE; -} -return EXIT_SUCCESS; }