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
cspice_exists

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_EXISTS returns a boolean indicating whether the input
   file exists (True) or not (False).

I/O


   Given:

      fname    the name of the file in question.

               help, fname
                  STRING = Scalar

               This may be any unambiguous file name valid on the user's
               computer, for example

                  '/usr/dir1/dir2/DATA.DAT'
                  './DATA.DAT'
                  'c:\usr\dir1\dir2\data.dat'

               Environment or shell variables may not be used.

   the call:

      exists = cspice_exists( fname )

   returns:

      exists   the value True if the file exists, False otherwise.

               help, exists
                  BOOLEAN = Scalar

Parameters


   None.

Examples


   Any numerical results shown for these examples may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Given two arbitrary files (one of them the actual code example
      source file), determine if they exists.

      Example code begins here.


      PRO exists_ex1

         ;;
         ;; Define an array of file names.
         ;;
         fname = [ 'exists_ex1.txt', 'exists_ex1.pro' ]

         for i=0, (n_elements(fname) - 1) do begin

            if ( cspice_exists( fname[i] ) ) then begin

               print, 'The file ', fname[i], ' exists.'

            endif else begin

               print, 'Cannot find the file ', fname[i]

            endelse

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Cannot find the file exists_ex1.txt
      The file exists_ex1.pro exists.


   2) Repeat the example using the native IDL code to perform
      the same task.

      Example code begins here.


      PRO exists_ex2

         ;;
         ;; Define an array of file names.
         ;;
         fname = [ 'exists_ex2.txt', 'exists_ex2.pro' ]

         for i=0, (n_elements(fname) - 1) do begin

            if ( findfile( fname[i] ) ) then begin

               print, 'The file ', fname[i], ' exists.'

            endif else begin

               print, 'Cannot find the file ', fname[i]

            endelse

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Cannot find the file exists_ex2.txt
      The file exists_ex2.pro exists.


Particulars


   None.

Exceptions


   1)  If the filename is blank, the error SPICE(BLANKFILENAME) is
       signaled by a routine in the call tree of this routine.

   2)  If an i/o error occurs while checking the existence of the
       indicated file, the error SPICE(INQUIREFAILED) is signaled by
       a routine in the call tree of this routine.

   3)  If the input argument `fname' is undefined, an error is
       signaled by the IDL error handling system.

   4)  If the input argument `fname' is not of the expected type, or
       it does not have the expected dimensions and size, an error is
       signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.1.0, 25-AUG-2021 (JDR)

       Changed the input argument name "name" to "fname" for
       consistency with other routines.

       Edited the header to comply with NAIF standard. Added complete code
       example.

       Edited the -I/O section to match standard format.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.1, 09-DEC-2005 (EDW)

       Added -Examples section.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   does the file exist



Fri Dec 31 18:43:04 2021