Close a file designated by a Fortran-style integer logical unit.
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- unit I Fortran-style logical unit.
unit is an integer representing a Fortran logical unit. Fortran logical units are integers which in the Fortran language play a role analogous to pointers to FILE structures in C. In Fortran, when a file is opened and a logical unit is associated with the file, the file and unit are said to be ``connected.'' A logical unit, once connected to a file, may be used to refer to the file in Fortran I/O statements.
This function is provided in order to fully support the file I/O interface provided by those CSPICE functions generated by running f2c on Fortran SPICELIB routines. ftncls_c should be used to close files opened by these functions ONLY IF the files in question would normally be closed, after having been opened by a Fortran program, by a Fortran CLOSE statement. If a file has been opened by a function that has a corresponding "close file" function, the latter should be used to close a file. Examples are the DAF and DAS families of functions: DAFs are normally closed via dafcls_ and DAS files are normally closed via dascls_.
1) Extract comments from a DAF-based kernel---an SPK file for example---into a text file. #include <string.h> #include "SpiceUsr.h" . . . #define SPK "my.bsp" #define OUTFILE "my.txt" SpiceInt handle; SpiceInt unit; /. Open a new text file for write access, obtaining a Fortran logical unit. ./ txtopn_ ( OUTFILE, &unit, strlen(OUTFILE) ); /. Open the SPK file from which comments are to be extracted. ./ dafopr_ ( SPK, &handle, strlen(SPK) ); /. Extract comments into the text file. ./ spcec_ ( &handle, &unit ); /. Close the text file. ./ ftncls_c ( unit );
The file connnected to unit would normally have been opened via a call to a function generated by running f2c on a Fortran SPICELIB routine. Examples of such functions are txtopn_ txtopr_
W.L. Taber (JPL) I.M. Underwood (JPL) E.D. Wright (JPL)
1) Refer to the SPK required reading file for a complete list of the NAIF integer ID codes for bodies.
-CSPICE Version 1.0.0, 24-MAY-1999 (NJB)
close file designated by Fortran logical unit