FileSystem.FileAttr(Int32) Method

Definition

Returns an enumeration representing the file mode for files opened using the FileOpen function. The FileSystem gives you better productivity and performance in file I/O operations than the FileAttr function. See GetFileInfo(String) for more information.

C#
public static Microsoft.VisualBasic.OpenMode FileAttr(int FileNumber);

Parameters

FileNumber
Int32

Required. Integer. Any valid file number.

Returns

One of the following values:

ValueFile access mode
1OpenMode.Input
2OpenMode.Output
4OpenMode.Random
8OpenMode.Append
32OpenMode.Binary

Examples

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

VB
Dim mode As OpenMode
FileOpen(1, "c:\TESTFILE.TXT", OpenMode.Input)
mode = FileAttr(1)
MsgBox("The file mode is " & mode.ToString())
FileClose(1)

Remarks

This function returns an enumeration representing the file mode for files opened using the FileOpen function.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also