Futurebasic/Language/Reference/usr fsfileexists

From Wikibooks, open books for an open world
Jump to navigation Jump to search


Revised February, 2002 (Release 6)

Description - Your program may determine whether or not a file exists using this function. A non-zero value is returned when the file is present. You need to pass a file spec record which can be created using FN FBmakeFSSpec or by using a file spec version of the FILES$ function. To determine if a file named "My File" is present in the application folder your would use the following code.

INCLUDE "Util_Files.incl" DIM fs AS FSSpec FN FBmakeFSSpec(SYSTEM(_aplVol),0,"My File",fs) LONG IF USR FSFILEEXISTS(fs)

  PRINT "File exists!"

END IF Note: You will not be able to use this function unless you include the proper header file as follows:

INCLUDE "Util_Files.incl"


Appendix H: File Spec Records; FILES$