FileAttr funktsioon

Tagastab lause Open abil avatud faili juurdepÀÀsureĆŸiimi vĂ”i faili lugemise numbri. Faili lugemise number sĂ”ltub operatsioonisĂŒsteemist (OSH = Operating System Handle, operatsioonisĂŒsteemi pide).

MĂ€rkuse ikoon

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


Vaata ka: Open

SĂŒntaks:


  FileAttr (Channel As Integer, Attributes As Integer)

TagastusvÀÀrtus:

TĂ€isarv

Parameetrid:

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.

Kui mÀÀrad parameetri atribuudi vÀÀrtuseks 1, siis kehtivad jÀrgmised tagastusvÀÀrtused:

1 - INPUT (fail on sisestuseks avatud)

1 - OUTPUT (fail on vÀljastuseks avatud)

4 - RANDOM (fail on juhuslikuks juurdepÀÀsuks avatud)

8 - APPEND (fail on lisamiseks avatud)

32 - BINARY (fail on avatud kahendreĆŸiimis).

Veakoodid:

5 Vigane protseduuri vÀljakutse

52 Vigane failinimi vÔi failide arv

NĂ€ide:


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, "See on rida teksti"
    MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
    MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
    Close #iNumber
End Sub

Palun toeta meid!