The File$(N) internal function returns the path and name of file N. When used without parameters, FILE$ returns the name of the file from the last error in an OPEN statement or any other I/O statement.
Comments and Examples
FILE$(0) returns the device name for the current workstation. This function can be used to determine whether a program is running on a DOS or Unix / Linux system. DOS versions will return CON:, whereas Unix / Linux versions will return a string beginning with :/dev/tty. See the SYSTEM command for a detailed example of using FILE$(0) to increase portability of operating system dependent SYSTEM commands.
- As in the following example, the string returned by FILE$ may be used as a valid file name
00010 OPEN #1:"name="&FILE$(0),DISPLAY,OUTPUT
FILE$(fileno,”HTTPINFO”) returns LOG info for the latest action, important while OPENing DISPLAY files.
For additional information about files, see the following functions:
- If the current error was not an I/O error, FILE$ will be irrelevant because it contains information about a previous error.