summaryrefslogtreecommitdiffstats
path: root/doxygen/dox/cookbook/Accessibility.c
blob: f4cc905c09b95ab30b343f661235d6f4f67de1d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* -*- c-file-style: "stroustrup" -*- */

#include "hdf5.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
    int ret_val = EXIT_SUCCESS;

    //! <!-- [set_libver_bounds] -->
    {
        __label__ fail_fapl, fail_file;
        hid_t fapl, file, aspace, attr;

        if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
            ret_val = EXIT_FAILURE;
            goto fail_fapl;
        }
#if H5_VERSION_GE(1, 10, 0)
        if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0) {
#elif H5_VERSION_GE(1, 8, 0)
        if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
#else
#error Only HDF5 1.8.x and later supported.
#endif
            ret_val = EXIT_FAILURE;
            goto fail_file;
        }
        if ((file = H5Fcreate("set_libver_bounds.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
            ret_val = EXIT_FAILURE;
            goto fail_file;
        }

        H5Fclose(file);
fail_file:
        H5Pclose(fapl);
fail_fapl:;
    }
    //! <!-- [set_libver_bounds] -->

    assert(ret_val == EXIT_SUCCESS);

    return ret_val;
}