File$: Difference between revisions
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
For additional information about files, see the following functions: | For additional information about files, see the following functions: | ||
*[[Exists]] | *[[Exists]] | ||
*[[File]] | *[[File (internal function)]] | ||
*[[FileNum]] | *[[FileNum]] | ||
*[[FreeSp]] | *[[FreeSp]] |
Revision as of 11:32, 24 January 2012
File$(N)
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
Related Functions
For additional information about files, see the following functions:
Technical Considerations
- If the current error was not an I/O error, FILE$ will be irrelevant because it contains information about a previous error.