/*
 *    Creating and closing a file.
 */

#include <hdf5.h>
#define FILE "file.h5"

int main() {

   hid_t       file_id, fapl, grp_id;   /* file identifier */
   herr_t      status;
   H5F_close_degree_t degree;
  
   fapl = H5Pcreate (H5P_FILE_ACCESS);

/*  Uncomment this line and the H5Gclose will fail because 'MyGroup' is
    already closed.  
   status = H5Pset_fclose_degree ( fapl, H5F_CLOSE_STRONG);

 end */ 

   file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
   grp_id = H5Gcreate (file_id, "MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);

   status = H5Pget_fclose_degree (fapl, &degree);
   printf ("H5Pget_fclose_degree returns: %i\n", degree); 

   status = H5Pclose (fapl);
   printf ("H5Pclose returns: %i\n", status);

   status = H5Fclose(file_id); 
   printf ("H5Fclose returns: %i\n", status);

   status = H5Gclose (grp_id);
   printf ("H5Gclose returns: %i\n", status);

}


