Returns an enumeration representing the file mode for files opened using the FileOpen function.
Public Function FileAttr(ByVal FileNumber As Integer) As OpenMode
| Exception type | Error number | Condition |
|---|---|---|
| 52 | FileNumber does not exist. | |
| 54 | File mode is invalid. |
The following enumeration values indicate the file access mode:
| Value | Mode |
|---|---|
| 1 | OpenMode.Input |
| 2 | OpenMode.Output |
| 4 | OpenMode.Random |
| 8 | OpenMode.Append |
| 32 | OpenMode.Binary |
This example uses the FileAttr function to return the file mode of an open file.
Dim mode As OpenMode FileOpen(1, "c:\MYFILE.TXT", OpenMode.Input) mode =FileAttr(1)MsgBox("The file mode is " & mode.ToString()) FileClose(1)
GetAttr Function | FileOpen Function | SetAttr Function |