FileAttr Function

Description

Returns file mode or operating system file handle information for files opened using the Open statement.

Syntax

FileAttr(filenumber, returntype)

The FileAttr function syntax has these named arguments:

Part

Description

filenumber

Any valid file number.

returntype

Number indicating the type of information to return. Specify 1 to return a value indicating the file mode. Specify 2 to return the operating system file handle.


Return Values

When the returntype argument is 1, the following return values indicate the file access mode:

Value

File Mode

1

Input

2

Output

4

Random

8

Append

32

Binary


See Also

GetAttr Function, Open Statement, SetAttr Statement.

Example

This example uses the FileAttr function to return the file mode and file handle of an open file.


FileNum = 1    ' Assign file number."TESTFILE" For Append As FileNum    ' Open file.= FileAttr(FileNum, 1)    ' Returns 8 (Append file mode).= FileAttr(FileNum, 2)    ' Returns file handle.FileNum    ' Close file.