From BR Wiki
Jump to: navigation, search
File$(<file name>)

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.

FILE$(0) will now be displayed without a leading colon if OPTION 25 is specified. In 3.9, File$(0) displays with a leading colon to signify that it is not a normal data file.

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.

Related Functions

For additional information about files, see the following functions:

Technical Considerations

  1. If the current error was not an I/O error, FILE$ will be irrelevant because it contains information about a previous error.