1funflush(3)                   SAORD Documentation                  funflush(3)
2
3
4

NAME

6       FunFlush - flush data to output file
7

SYNOPSIS

9         #include <funtools.h>
10
11         void FunFlush(Fun fun, char *plist)
12

DESCRIPTION

14       The FunFlush routine will flush data to a FITS output file.  In partic‐
15       ular, it can be called after all rows have been written (using the
16       FunTableRowPut() routine) in order to add the null padding that is
17       required to complete a FITS block. It also should be called after com‐
18       pletely writing an image using FunImagePut() or after writing the final
19       row of an image using FunTableRowPut().
20
21       The plist (i.e., parameter list) argument is a string containing one or
22       more comma-delimited keyword=value parameters.  If the plist string
23       contains the parameter "copy=remainder" and the file was opened with a
24       reference file, which, in turn, was opened for extension copying (i.e.
25       the input FunOpen() mode also was "c" or "C"), then FunFlush also will
26       copy the remainder of the FITS extensions from the input reference file
27       to the output file.  This normally would be done only at the end of
28       processing.
29
30       Note that FunFlush() is called with "copy=remainder" in the mode string
31       by FunClose().  This means that if you close the output file before the
32       reference input file, it is not necessary to call FunFlush() explic‐
33       itly, unless you are writing more than one extension.  See the evmerge
34       example code. However, it is safe to call FunFlush() more than once
35       without fear of re-writing either the padding or the copied extensions.
36
37       In addition, if FunFlush() is called on an output file with the plist
38       set to "copy=reference" and if the file was opened with a reference
39       file, the reference extension is written to the output file.  This
40       mechanism provides a simple way to copy input extensions to an output
41       file without processing the former.  For example, in the code fragment
42       below, an input extension is set to be the reference file for a newly
43       opened output extension. If that reference extension is not a binary
44       table, it is written to the output file:
45
46         /* process each input extension in turn */
47         for(ext=0; ;ext++){
48           /* get new extension name */
49           sprintf(tbuf, "%s[%d]", argv[1], ext);
50           /* open input extension -- if we cannot open it, we are done */
51           if( !(ifun=FunOpen(tbuf, "r", NULL)) )
52             break;
53           /* make the new extension the reference handle for the output file */
54           FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
55           /* if its not a binary table, just write it out */
56           if( !(s=FunParamGets(ifun, "XTENSION", 0, NULL, &got)) ⎪⎪
57             strcmp(s, "BINTABLE")){
58             if( s ) free(s);
59             FunFlush(ofun, "copy=reference");
60             FunClose(ifun);
61             continue;
62           }
63           else{
64             /* process binary table */
65             ....
66           }
67         }
68

SEE ALSO

70       See funtools(n) for a list of Funtools help pages
71
72
73
74version 1.4.2                   January 2, 2008                    funflush(3)
Impressum