File$: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (moved File$ to FILE$)
No edit summary
Line 1: Line 1:
File$(N)
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.
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====
====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) 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.


Line 13: Line 14:


====Related Functions====
====Related Functions====
For additional information about files, see the following functions:  
For additional information about files, see the following functions:  
*[[Exists]]
*[[Exists]]
Line 26: Line 28:


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



Revision as of 11:28, 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

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