Returns a Long representing the file mode for files opened using the Open statement.
Syntax
FileAttr(filenumber, returntype) |
Part | Description |
filenumber | Required; Integer. Any validfile number. |
returntype |
Required; Integer. Number indicating the type of information to return. Specify 1 to return a value indicating the file mode. On 16-bit systems only, specify 2 to retrieve an operating system file handle. Returntype 2 is not supported in 32-bit systems and causes an error. |
When the returntype argument is 1, the following return values indicate
the file access mode:
Режим |
Значение |
Input | 1 |
Output | 2 |
Random | 4 |
Append | 8 |
Binary | 32 |
This example uses the FileAttr function to return the file mode and
file handle of an open file.
Dim FileNum, Mode, Handle FileNum = FreeFile() ' Assign file number. Open "TESTFILE" For Append As FileNum ' Open file. Mode = FileAttr(FileNum, 1) ' Returns 8 (Append file mode). Handle = FileAttr(FileNum, 2) ' Returns file handle. Close FileNum ' Close file. Trace Mode |
See Also |
Open Statement, SetAttr Statement , GetAttr Function |