Source
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 example illustrates how to read/write a subset of data (a slab)
* from/to a dataset in an HDF5 file. It is used in the HDF5 Tutorial.
*/
int
main (void)
{
hsize_t dims[2], dimsm[2];
int data[DIM0][DIM1]; /* data to write */
int sdata[DIM0_SUB][DIM1_SUB]; /* subset to write */
int rdata[DIM0][DIM1]; /* buffer for read */
hid_t file_id, dataset_id; /* handles */
hid_t dataspace_id, memspace_id;
herr_t status;
hsize_t count[2]; /* size of subset in the file */
hsize_t offset[2]; /* subset offset in the file */
hsize_t stride[2];
hsize_t block[2];
int i, j;