Index Page ftncls_c

A B C D E F G H I J K L M N O P Q R S T U V W X

Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

       void ftncls_c ( SpiceInt unit )

#### Abstract

       Close a file designated by a Fortran-style integer logical unit.

#### Required_Reading

       None.

#### Keywords

       FILES

#### Brief_I/O

       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       unit       I   Fortran-style logical unit.

#### Detailed_Input

       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.

#### Detailed_Output

       None.

#### Parameters

       None.

#### Exceptions

       Error free.

#### Files

       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_

#### Particulars

       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_.

#### Examples

       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 );

#### Restrictions

       1)

#### Literature_References

       1) Refer to the SPK required reading file for a complete list of
          the NAIF integer ID codes for bodies.

#### Author_and_Institution

       W.L. Taber      (JPL)
       I.M. Underwood  (JPL)
       E.D. Wright     (JPL)

#### Version

       -CSPICE Version 1.0.0, 24-MAY-1999 (NJB)

#### Index_Entries

       close file designated by Fortran logical unit

#### Link to routine ftncls_c source file ftncls_c.c

    Wed Apr  5 17:54:35 2017