XFID() Function - Get File Identification
Syntax
XFID(channelno{,ERR=lineref})
Description
The XFID() function returns a string describing the attributes of the file currently OPENed on channelno. If channelno was OPENed with an alias and resulted in opening a BBj device, XFID() returns only the alias name.
Channel zero refers to the terminal device. Normally, the value returned by XFID(0) is the terminal alias (T0, T1, etc.). However, if BBj is running in background or with redirected standard I/O, the file name associated with channel 0 will be IO, which has no special capabilities other than to read and write data.
If the channel was opened without an alias, then XFID() returns a string with the following information:
| Bytes | Contents | Conversion Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1,1 | File Type | XFID$(1,1)
The XFID() file type can be modified by flags that define variations of MKEYED and XKEYED files. The flags have the following meanings:
The following combinations are possible:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2,4 | Logical key size or 0 for MKEYED, XKEYED, or VKEYED files | DEC(XFID$(2,4))
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6,4 | Number of records or -1 for byte-oriented files | DEC(XFID$(6,4))
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10,4 | Bytes per record or -1 for byte-oriented files. | DEC(XFID$(10,4))
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14,* | File name | XFID$(14)
|
The XFIN() Function may also be used to provide information about an open file.
Examples
>LET FILE$=XFID(6)
>PRINT FILE$(14)
/usr/bbx/prog1
>PRINT DEC(FILE$(10,4))
-1