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

int qfits_header_dump ( const qfits_header hdr,
FILE *  out 
)

Dump a FITS header to an opened file.

Parameters:
hdr FITS header to dump
out Opened file pointer
Returns:
int 0 if Ok, -1 otherwise Dumps a FITS header to an opened file pointer.

Definition at line 825 of file qfits_header.c.

References first.

Referenced by qfits_save_table_hdrdump(), and qfits_table_append_xtension_hdr().

{
    keytuple    *   k ;
    char            line[81];
    int             n_out ;    

    if (hdr==NULL) return -1 ;
    if (out==NULL) out=stdout ;

    k = (keytuple*)hdr->first ;
    n_out = 0 ;
    while (k!=NULL) {
        /* Make line from information in the node */
        qfits_header_makeline(line, k, 1);
        if ((fwrite(line, 1, 80, out))!=80) {
            fprintf(stderr, "error dumping FITS header");
            return -1 ;
        }
        n_out ++;
        k=k->next;
    }
    /* If printing out to a regular file, blank pad */
    if (out!=stdout && out!=stderr) {
        /* Blank-pad the output */
        memset(line, ' ', 80);
        while (n_out % 36) {
            fwrite(line, 1, 80, out);
            n_out++ ;
        }
    }
    return 0 ;
}


Generated by  Doxygen 1.6.0   Back to index