FileAttr Fonksiyonu

Open deyimi ile açılmış bir dosyanın erişim kipini veya dosya erişim numarasını döndürür. Dosya erişim numarası işletim sistemine bağlıdır (OSH = İşletim Sistemi İşleci)

Not Simgesi

If you use a 32-Bit operating system, you cannot use the FileAttr function to determine the file access number.


Ayrıca buna bakın:

Sözdizimi:


  FileAttr (Channel As Integer, Attributes As Integer)

Dönüş değeri:

Tamsayı

Parametreler:

Channel: The number of the file that was opened with the Open statement.

Attributes: Integer expression that indicates the type of file information that you want to return. The following values are possible:

1: FileAttr indicates the access mode of the file.

2: FileAttr returns the file access number of the operating system.

Eğer bir parametre özniteliğik değerini 1 gibi bir değerler belirtirseniz, takip eden geri dönüş değerleri uygulanır:

1 - GİRDİ (girdi için dosya aç)

2 - ÇIKTI (çıktı için dosya aç)

4 - RASTGELE (rastgele erişim için dosya aç)

8 - SONA EKLE (sona eklemek için dosya aç)

32 - İKİLİK (ikilik kipte dosya aç)

Hata kodları:

5 Geçersiz yordam çağrısı

52 Geçersiz dosya adı veya numarası

Örnek:


Sub ExampleFileAttr
    Dim iNumber As Integer
    Dim sLine As String
    Dim aFile As String
    aFile = "C:\Users\ThisUser\data.txt"
    iNumber = Freefile
    Open aFile For Output As #iNumber
    Print #iNumber, "Bu metnin bir satırıdır"
    MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
    MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
    Close #iNumber
End Sub

Lütfen bizi destekleyin!