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-argument parts:
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 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. Open "TESTFILE" For Append As FileNum ' Open file. Handle = FileAttr(FileNum, 1) ' Returns 8 (Append file mode). Mode = FileAttr(FileNum, 2) ' Returns file handle. Close FileNum ' Close file.