Source
attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* This program illustrates the usage of the H5A Interface functions.
* It creates and writes a dataset, and then creates and writes array,
* scalar, and string attributes of the dataset.
* Program reopens the file, attaches to the scalar attribute using
* attribute name and reads and displays its value. Then index of the
* third attribute is used to read and display attribute values.
* The H5Aiterate function is used to iterate through the dataset attributes,
* and display their names. The function is also reads and displays the values
* of the array attribute.
*/
static herr_t attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata);
/* Operator function */
int
main (void)
{
hid_t file, dataset; /* File and dataset identifiers */
hid_t fid; /* Dataspace identifier */
hid_t attr1, attr2, attr3; /* Attribute identifiers */