File$: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (moved File$ to FILE$)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
File$(N)
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.
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.


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.
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.
Line 11: Line 12:


  00010 OPEN #1:"name="&FILE$(0),DISPLAY,OUTPUT
  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====
====Related Functions====
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]]
Line 26: Line 30:


====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.



Latest revision as of 17:26, 25 September 2014

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.