void dafrfr_c ( SpiceInt handle,
SpiceInt lenout,
SpiceInt * nd,
SpiceInt * ni,
SpiceChar * ifname,
SpiceInt * fward,
SpiceInt * bward,
SpiceInt * free )
Read the contents of the file record of a DAF.
DAF
FILES
Variable I/O Description
-------- --- --------------------------------------------------
handle I Handle of an open DAF file.
lenout I Available room in the output string `ifname'.
nd O Number of double precision components in summaries.
ni O Number of integer components in summaries.
ifname O Internal file name.
fward O Forward list pointer.
bward O Backward list pointer.
free O Free address pointer.
handle is the handle assigned to a DAF file opened for
reading.
lenout is the maximum number of characters that can be
accommodated in the output string `ifname'. This count
includes room for the terminating null character.
DAF internal file names may contain up to 60
characters, so lenout normally should be set to 61.
nd,
ni are the numbers of double precision and integer
components, respectively, in each array summary in
the specified file.
ifname is the internal file name stored in the first
(or file) record of the specified file. `ifname'
should be declared with the length specified by
`lenout'.
fward is the forward list pointer. This points to the
first summary record in the file. (Records between
the first record and the first summary record are
reserved when the file is created, and are invisible
to DAF routines.)
DAF list pointers are actually Fortran record numbers,
and as such, start at one.
bward is the backward list pointer. This points
to the final summary record in the file.
free is the free address pointer. This contains the
first free address in the file. (That is, the
initial address of the next array to be added
to the file.)
`free' is a DAF address; for compatiblity with
SPICELIB, the range of DAF addresses starts at 1.
None.
1) If the handle passed to this routine is not the handle of an
open DAF file, the error will be signaled by a routine called
by this routine.
2) If the specified DAF file is not open for read access, the
error will be diagnosed by a routine called by this routine.
3) If the specified record cannot (for some reason) be read,
the error SPICE(DAFFRNOTFOUND) is signaled.
The input `handle' should refer to a DAF file open for read
or write access.
The file record of a DAF is the only record that contains
any global information about the file. This record is created
when the file is created, and is updated only when new arrays
are added.
Like character records, file records are not buffered.
In the following example, the file record of a DAF is read
to determine the first free address in the file.
#include <stdio.h>
#include "SpiceUsr.h"
int main ()
{
#define IFNLEN 61
SpiceChar ifname[IFNLEN];
SpiceInt bward;
SpiceInt free;
SpiceInt fward;
SpiceInt handle;
SpiceInt nd;
SpiceInt ni;
SpiceChar * kernel = "/kernels/gen/spk/de421.bsp";
dafopr_c ( kernel, &handle );
dafrfr_c ( handle, IFNLEN, &nd, &ni, ifname, &fward, &bward, &free );
printf ( "First free DAF address is %d.\n", (int)free );
/.
Safely close the DAF.
./
dafcls_c ( handle );
return ( 0 );
}
The program outputs:
First free DAF address is 2098645.
None.
None.
N.J. Bachman (JPL)
K.R. Gehringer (JPL)
I.M. Underwood (JPL)
-CSPICE Version 1.0.1, 28-JUN-2016 (EDW)
Edit to Example code, SpiceInts output as ints using
explicit casting.
-CSPICE Version 1.0.0, 17-JUN-2009 (NJB) (KRG) (IMU)
read daf file record
Link to routine dafrfr_c source file dafrfr_c.c
|