index
, and by its annotation type, annot_type
. The syntax for ANselect is as follows:C: ann_id = ANselect(an_id, index, annot_type);
FORTRAN: ann_id = afselect(an_id, index, annot_type)The parameter
index
is a nonnegative integer and is less than the total number of annotations of type annot_type
in the file. Use ANfileinfo, described in Section 10.6.1 on page 329, to obtain the total number of annotations of type annot_type
in the file.
ANselect returns an annotation identifier or FAIL
(or -1
) upon unsuccessful completion. The parameters of ANselect are further described in Vdata .
ann_id
and stores the annotation text in the parameter ann_buf
. The syntax for ANreadann is as followsC: status = ANreadann(ann_id, ann_buf, ann_length);
FORTRAN: status = afreadann(ann_id, ann_buf, ann_length)The parameter
ann_length
specifies the size of the buffer ann_buf
. If the length of the file or data label to be read is greater than or equal to ann_length
, the label will be truncated to ann_length
- 1 characters. If the length of the file or data description is greater than ann_length
, the description will be truncated to ann_length
characters. The HDF library adds a NULL
character to the retrieved label but not to the description. The user must add a NULL
character to the retrieved description if the C library string functions are to operate on this description.
ANreadann returns either SUCCEED
(or 0
) or FAIL
(or -1
). The parameters of ANreadann are further described in Table 10D.
In this example, the program reads some of the annotations created in the file "General_HDFobjects.hdf" by Example 1. The program first gets the information on the annotations in the file so that the number of existing annotations of each kind is available prior to reading. The program then gets the length of each annotation and allocates sufficient space for the contents of the annotation to be read. For the simplicity of this example, only the data labels are read. Any other annotations can be read by adding the for loop with appropriate values as noted below.
This example uses the ANfileinfo/affileinfo routine to get annotation information. This rouitne is described in the Section 10.6.1