FileSystem.FileAttr Method

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 for more information.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static OpenMode FileAttr(
	int FileNumber
)

Parameters

FileNumber
Type: System.Int32

Required. Integer. Any valid file number.

Return Value

Type: Microsoft.VisualBasic.OpenMode
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 function returns an enumeration representing the file mode for files opened using the FileOpen function.

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

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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft