This documentation is archived and is not being maintained.

FileSystem.FileAttr Method

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

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

public static OpenMode FileAttr (
	int FileNumber
)
public static OpenMode FileAttr (
	int FileNumber
)
public static function FileAttr (
	FileNumber : int
) : OpenMode
Not applicable.

Parameters

FileNumber

Required. Integer. Any valid file number.

Return Value

Value 1, Mode OpenMode.Input. Value 2, Mode OpenMode.Output. Value 4, Mode OpenMode.Random. Value 8, Mode OpenMode.Append. Value 32, Mode OpenMode.Binary.

For more detailed information, see the Visual Basic topic FileAttr Function.

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)

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: