1
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
2
+
 * Copyright by The HDF Group.                                               *
 
3
+
 * All rights reserved.                                                      *
 
4
+
 *                                                                           *
 
5
+
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 
6
+
 * terms governing use, modification, and redistribution, is contained in    *
 
7
+
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 
8
+
 * of the source code distribution tree; Copyright.html can be found at the  *
 
9
+
 * root level of an installed copy of the electronic HDF5 document set and   *
 
10
+
 * is linked from the top-level documents page.  It can also be found at     *
 
11
+
 * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
 
12
+
 * access to either file, you may request a copy from help@hdfgroup.org.     *
 
13
+
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
14
+
 
15
+
#include "hdf5.h"
 
16
+
 
17
+
#define FILENAME        "compat_h5g.h5"
 
18
+
#define GROUPNAME       "Group1"
 
19
+
 
20
+
/*
 
21
+
 * Basic tests of group (H5G) API routines, to verify that API compatibility
 
22
+
 *      is working in the 1.8+ versions of the library
 
23
+
 */
 
24
+
 
25
+
int
 
26
+
main(int argc, const char *argv[])
 
27
+
{
 
28
+
    hid_t fid;          /* File ID */
 
29
+
    hid_t gid;          /* Group ID */
 
30
+
 
31
+
    /* Shut compiler up */
 
32
+
    argc = argc;
 
33
+
    argv = argv;
 
34
+
 
35
+
    /* Create file */
 
36
+
    if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
 
37
+
 
38
+
    /* Create group */
 
39
+
#if defined(H5Gcreate_vers) && H5Gcreate_vers > 1
 
40
+
    if((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
 
41
+
#else /* H5Gcreate_vers */
 
42
+
    if((gid = H5Gcreate(fid, GROUPNAME, (size_t)0)) < 0) goto error;
 
43
+
#endif /* H5Gcreate_vers */
 
44
+
 
45
+
    /* Close group */
 
46
+
    if(H5Gclose(gid) < 0) goto error;
 
47
+
 
48
+
    /* Close file */
 
49
+
    if(H5Fclose(fid) < 0) goto error;
 
50
+
 
51
+
 
52
+
    return(0);
 
53
+
 
54
+
error:
 
55
+
    return(1);
 
56
+
}
 
57
+