c++ - Check the validity of HDF5 files -


based on example given here, have file image loaded memory string valid handler. done using h5ltopen_file_image().

now question is, how can check valid hdf5 file? found program called h5check, has complicated source code. i'm wondering, there simple function simple return value verify whatever in hid_t handler valid hdf5 file?

in c++:

    std::string filename = "foo.h5";     if(!h5::h5file::ishdf5(filename.c_str()))     {         std::string err_msg = filename + " not hdf5 file.\n";         throw std::logic_error(err_msg);     } 

in python, use

import h5py if not h5py.is_hdf5('foo.h5'):     raise valueerror('not hdf5 file') 

Comments