Logo Search packages:      
Sourcecode: qfits version File versions  Download package

char* qfits_header_getstr ( const qfits_header hdr,
const char *  key 
)

Return the value associated to a key, as a string.

Parameters:
hdr qfits_header to parse
key key to find
Returns:
pointer to statically allocated string
Finds the value associated to the given key and return it as a string. The returned pointer is statically allocated, so do not modify its contents or try to free it.

Returns NULL if no matching key is found or no value is attached.

Definition at line 579 of file qfits_header.c.

References first, and qfits_expand_keyword().

Referenced by qfits_header_getboolean(), qfits_header_getdouble(), qfits_header_getint(), and qfitsloader_init().

{
    keytuple    *   k ;
    char        *   xkey ;

    if (hdr==NULL || key==NULL) return NULL ;

    xkey = qfits_expand_keyword(key);
    k = (keytuple*)hdr->first ;
    while (k!=NULL) {
        if (!strcmp(k->key, xkey)) break ;
        k=k->next ;
    }
    if (k==NULL) return NULL ;
    return k->val ;
}


Generated by  Doxygen 1.6.0   Back to index