Reading a File


Contents:



How to Read an SDS

Typical functions that you would use to read an SDS are as follows:

Sample Program to Read an SDS

Take example sd_create.c, created earlier, and add a call to read back the data (You can either download the C or FORTRAN program at the end, or just take a look at the HTML version with the HDF calls highlighted): If you have downloaded this program, then you can compile and run it. It creates an HDF file called sd.hdf. You can view the output from this program in the next section, "Output from Sample Program".

Following is a detailed review of what this program does:


Output from Sample Program

Following is what this program outputs to the screen:

... sd.hdf created
... data1 created
... data written out
... file closed
... sd.hdf opened with READ access

Data: 
  1   2   3   4   5 
  2   3   4   5   6 
  3   4   5   6   7 
  4   5   6   7   8 
  5   6   7   8   9 
  6   7   8   9   10 
  7   8   9   10   11 
  8   9   10   11   12 
  9   10   11   12   13 
  10   11   12   13   14 

... file closed


Download Sample Program (optional)

Programs used in this tutorial: [Compiling a program]