FileAttr Function
Returns the access mode or the file access number of a file that was opened with the Open statement. The file access number is dependent on the operating system (OSH = Operating System Handle).

If you use a 32-Bit operating system, you cannot use the FileAttr-Function to determine the file access number.
Lihat juga: Buka
Sintaksis:
FileAttr (NomorBerkas As Integer, Atribut As Integer)
Nilai hasil:
Integer
Parameter:
FileNumber: The number of the file that was opened with the Open statement.
Attribute: Integer expression that indicates the type of file information that you want to return. The following values are possible:
1: The FileAttr-Function indicates the access mode of the file.
2: The FileAttr-Function returns the file access number of the operating system.
If you specify a parameter attribute with a value of 1, the following return values apply:
1 - INPUT (berkas dibuka untuk masukan)
2 - OUTPUT (berkas dibuka untuk keluaran)
4 - RANDOM (berkas dibuka untuk akses acak)
8 - APPEND (berkas dibuka untuk ditambahkan/dilampirkan)
32 - BINARY (berkas dibuka dalam mode biner).
Contoh:
Sub ExampleFileAttr
Dim iNumber As Integer
Dim sLine As String
Dim aFile As String
aFile = "c:\data.txt"
iNumber = Freefile
Open aFile For Output As #iNumber
Print #iNumber, "Ini adalah baris teks"
MsgBox FileAttr(#iNumber, 1 ),0,"Mode akses"
MsgBox FileAttr(#iNumber, 2 ),0,"Atribut berkas"
Close #iNumber
End Sub