Hi Daniel,

fg_p must point to either a H5File or Group object, not CommonFG.
I hope that helps.

Binh-Minh

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Daniel Hornung
Sent: Wednesday, January 26, 2011 11:51 AM
To: [email protected]
Subject: [Hdf-forum] C++ API: Which exception for openDataSet?

Hello,

I'm doing my first steps with the C++ API, and there's one problem I can't
conquer:

I'm trying to test if a dataset exists using the following code:

        try{
            std::cout << "Trying to open DS..." << endl;
            H5::DataSet foo = fg_p->openDataSet(location);
        }

        catch(H5::GroupIException e) {
            std::cout << "GroupIException" << endl;
        }
        catch(H5::FileIException e) {
            std::cout << "FileIException" << endl;
        }
        catch (...) {
            std::cout << "Caught by ..." << endl;
            return false;
        }
        return true;

fg_p is a pointer to a CommonFG object, location is a string here.

For datasets that exist it works alright, but for a non-existing dataset,
only
the catch(...) is triggered. What would be the correct exception to catch
here?

Also is there a way to suppress all the HDF5-DIAG output that I get?

Thanks,
Daniel



_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to