/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 files COPYING and Copyright.html. COPYING can be found at the root * * of the source code distribution tree; Copyright.html can be found at the * * root level of an installed copy of the electronic HDF5 document set and * * is linked from the top-level documents page. It can also be found at * * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ #include "hdf5.h" /* Uses file created by h5_append_by_row.c */ #define FILENAME "append_by_row.h5" #define DATASETNAME "IntArray" #define RANK 2 #define RANKM 1 #define DIM0_SUB 1 /* subset dimensions */ #define DIM1_SUB 10 #define DIM0 8 /* size of dataset */ #define DIM1 10 int main (void) { hid_t file_id; /* handles */ hid_t dataset_id; hid_t dataspace_id, memspace_id, filespace_id; herr_t status; int rdata[DIM1]; /* buffer for read */ hsize_t dimsmr[1]; hsize_t roffset[2]={0,0}; /* subset offset for read */ hsize_t rcount[2]={DIM0_SUB, DIM1_SUB}; /* size of subset in the file */ int i,j; file_id = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); dataset_id = H5Dopen2 (file_id, DATASETNAME, H5P_DEFAULT); printf ("Read dataset by row and print.\n"); dimsmr[0] = DIM1; memspace_id = H5Screate_simple (RANKM, dimsmr, NULL); for (i = 0; i< DIM0; i++) { filespace_id = H5Dget_space (dataset_id); status = H5Sselect_hyperslab (filespace_id, H5S_SELECT_SET, roffset, NULL, rcount, NULL); status = H5Dread (dataset_id, H5T_NATIVE_INT, memspace_id, filespace_id, H5P_DEFAULT, rdata); for (j = 0; j