Reading transformed data from virtual file hdf5

I need to create a virutalized hdf5 file using api c/c++ and get its contents in binary format.

There is a code where I write an array to hdf5 dataset:

    std::vector<int> vec = {7, 1 -2, 0, 8, 6}; // array to write to dataset


    //create a virtual file in memory:
    hid_t faplist_id = H5Pcreate(H5P_FILE_ACCESS);
    H5Pset_fapl_core(faplist_id, 1, false);
    hid_t file_id = H5Fopen("data.h5", H5F_ACC_CREAT | H5F_ACC_RDWR, faplist_id);

    //using api c++ create a group and dataset with data
    H5::H5File file(file_id);
    H5::Group group = file.createGroup("/Data");

    hsize_t dims[1];
    dims[0] = vec.size();

    H5::DataSpace dataspace(1, dims);

    H5::DataSet dataset = file.createDataSet("/Data/IntArray", H5::PredType::NATIVE_INT, dataspace);
    dataset.write(, H5::PredType::NATIVE_INT);

    // here it is necessary to output a set of bytes contained in the file data.h5 into a standard stream


Is there any way to get a binary representation of the transformed HDF5 data?

Do you want to output just the dataset or do you want the file image?

i want to output the file image

Please take a look at these documents: