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

Table of contents

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

       ftncls_c ( Close file designated by Fortran unit )

       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

       None.

#### Literature_References

       None.

#### Author_and_Institution

       N.J. Bachman        (JPL)
       J. Diaz del Rio     (ODC Space)

#### Version

       -CSPICE Version 1.0.1, 14-APR-2021 (JDR)

           Edited the header to comply with NAIF standard. Remove non-applicable
           entry in -Literature_References.

       -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

    Fri Dec 31 18:41:07 2021