Creating/Reading Attributes


Contents:



How to Create/Read Attributes

Following are functions used in creating/reading attributes: (Functions in bold are included in the example program for this tutorial.)

Sample program

The following program adds an attribute to a Vgroup, and then reads it back in and prints it (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. Following is a detailed review of what this program does: This program prints out the following:
 Attribute name: Vgroup Attribute 1
 Attribute value: TEST1
NOTE: Vfindattr/vffdatt was not used in this program. If you know the name of the attribute, you can use this function instead of using Vnattrs/vfnatts.

Contents of HDF File

You can view the contents of the HDF file with the attribute, by using the vshow or the hdp command.

With hdp, the resulting HDF file looks as follows:

Notice that under "Vgroup:0" at the top, one attribute is listed called "Vgroup Attribute 1", with a value of "TEST1" and size of 5.

Download Sample Program (optional)

Programs used in this tutorial: [Compiling a program]