Table of contents
kinfo_c ( Kernel Information )
void kinfo_c ( ConstSpiceChar * file,
SpiceChar * filtyp,
SpiceChar * srcfil,
SpiceInt * handle,
SpiceBoolean * found )
Return information about a loaded kernel specified by name.
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
file I Name of a kernel to fetch information for
filtln I Available space in output kernel type string.
srclen I Available space in output `srcfil' string.
filtyp O The type of the kernel.
srcfil O Name of the source file used to load `file'.
handle O The handle attached to `file'.
found O SPICETRUE if the specified file could be located.
file is the name of a kernel file for which descriptive
information is desired.
filtln is the amount of available space in the output kernel
srclen is the amount of available space in the output kernel
filtyp is the type of the kernel specified by file. filtyp
will be empty if `file' is not on the list of kernels
loaded via furnsh_c.
srcfil is the name of the source file that was used to
specify file as one to load. If `file' was loaded
directly via a call to furnsh_c, `srcfil' will be empty.
If `file' is not on the list of kernels loaded via
furnsh_c, `srcfil' will be empty.
handle is the handle attached to `file' if it is a binary
kernel. If `file' is a text kernel or meta-text kernel
handle will be zero. If `file' is not on the list of
kernels loaded via furnsh_c, handle will be set to zero.
found is returned SPICETRUE if the specified file exists.
If there is no such file, found will be set to
1) If the specified file is not on the list of files that are currently
loaded via the interface furnsh_c, `found' will be SPICEFALSE,
`handle' will be set to zero and `filtyp' and `srcfil' will be set to
2) If any of `filtyp' or `srcfil' output strings has length too
short to contain the corresponding output string, the string
is truncated on the right.
3) If the `file' input string pointer is null, the error
SPICE(NULLPOINTER) is signaled.
4) If the `file' input string has zero length, the error
SPICE(EMPTYSTRING) is signaled.
5) If any of the `filtyp' or `srcfil' output string pointers is
null, the error SPICE(NULLPOINTER) is signaled.
6) If any of the `filtyp' or `srcfil' output strings has length
less than two characters, the error SPICE(STRINGTOOSHORT) is
signaled, since the output string is too short to contain one
character of output data plus a null terminator.
This routine allows you to request information directly
for a specific SPICE kernel.
The numerical results shown for this example may differ across
platforms. The results depend on the SPICE kernels used as
input, the compiler and supporting libraries, and the machine
specific arithmetic implementation.
1) Suppose you wish to determine the types of kernels loaded
by a given meta-kernel. The following code example shows
how you might use this routine to do this.
Use the meta-kernel shown below to load the required SPICE
File name: kinfo_ex1.tm
This meta-kernel is intended to support operation of SPICE
example programs. The kernels shown here should not be
assumed to contain adequate or correct versions of data
required by SPICE-based user applications.
In order for an application to use this meta-kernel, the
kernels referenced here must be present in the user's
current working directory.
The names and contents of the kernels referenced
by this meta-kernel are as follows:
File name Contents
de421.bsp Planetary ephemeris
pck00008.tpc Planet orientation and
KERNELS_TO_LOAD = ( 'de421.bsp',
End of meta-kernel
Example code begins here.
#define FILLEN 256
#define TYPLEN 33
#define SRCLEN 256
SpiceChar file [FILLEN];
Load the meta-kernel.
furnsh_c( "kinfo_ex1.tm" );
Find out the total number of kernels in the kernel pool.
ktotal_c ( "all", &count );
if ( count == 0 )
printf ( "No files loaded at this time.\n" );
printf ( "The loaded files files are: \n\n" );
Find the file name, type and source for each of the
kernels in the kernel pool and print its type.
for ( which = 0; which < count; which++ )
kdata_c ( which, "all", FILLEN, TYPLEN, SRCLEN,
file, filtyp, srcfil, &handle, &found );
kinfo_c ( file, TYPLEN, SRCLEN,
filtyp, srcfil, &handle, &found );
if ( eqstr_c ( filtyp, "SPK" ) )
printf ( "%s is an SPK file.\n", file );
else if ( eqstr_c ( filtyp, "CK" ) )
printf ( "%s is a CK file.\n", file );
else if ( eqstr_c ( filtyp, "PCK" ) )
printf ( "%s is a PCK file.\n", file );
else if ( eqstr_c ( filtyp, "DSK" ) )
printf ( "%s is a DSK file.\n", file );
else if ( eqstr_c ( filtyp, "EK" ) )
printf ( "%s is an EK file.\n", file );
else if ( eqstr_c ( filtyp, "META" ) )
printf ( "%s is a meta-text kernel.\n", file );
printf ( "%s is a text kernel.\n", file );
When this program was executed on a Mac/Intel/cc/64-bit
platform, the output was:
The loaded files files are:
kinfo_ex1.tm is a meta-text kernel.
de421.bsp is an SPK file.
pck00008.tpc is a text kernel.
naif0009.tls is a text kernel.
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
W.L. Taber (JPL)
E.D. Wright (JPL)
-CSPICE Version 1.3.0, 10-AUG-2021 (JDR)
Changed argument names "typlen" and "source" to "filtln" and
"srcfil" for consistency with other routines.
Edited the header to comply with NAIF standard. Added
meta-kernel and output solution to the example.
-CSPICE Version 1.2.0, 20-JAN-2016 (NJB)
Updated header example program to support DSKs.
Updated description of example program. Removed
references to the term "entry point." Added
Ed Wright as an author of this routine.
-CSPICE Version 1.1.2, 02-MAY-2008 (EDW)
standard.ker renamed standard.tm
-CSPICE Version 1.1.1, 05-SEP-2007 (EDW)
Expanded -Examples section to a full, compilable program.
-CSPICE Version 1.1.0, 02-FEB-2003 (EDW)
Corrected example code to match routine's argument list.
-CSPICE Version 1.0.0, 01-SEP-1999 (NJB) (WLT)
Fetch information about a loaded SPICE kernel