Next: Reading and writing header items from/to many images
Up: Examples of using HDR from C
Previous: Accessing header items using different data types
This example
(hdrlist.c)
shows how to access header items by index.
/* Local Variables: */
char value[80], item[30];
int nitem, i;
/* See how many items are present (this also accesses the image). */
hdrNumb( "in", " ", "*", &nitem, istat );
for( i=1; i<=nitem; i++ ) {
/* Get the name of the I'th header item. */
hdrName( "in", source, i, item, 30, istat ); [1]
/* Get its value and print out the item name and value. */
hdrInC( "in", source, item, 1, value, 80, istat ); [1]
printf( "%s = %s \n", item, value );
}
The following notes refer to the numbered statements:
- 1.
- Note the extra arguments (30 & 80) that pass the
maximum length of the output strings.
Next: Reading and writing header items from/to many images
Up: Examples of using HDR from C
Previous: Accessing header items using different data types
IMG Simple Image Data Access
Starlink User Note 160
P.W. Draper
R.F. Warren-Smith
3 March 2003
E-mail:P.W.Draper@durham.ac.uk
Copyright © 2000-2003 Council for the Central Laboratory of the Research Councils