FileAttr Function

Vraca pristupni oblik ili pristupni broj fajla kajo je otvoren sa Otvori izjavom. Pristupni broj fajla ovisi o pperativnom sistemu (POS = Podrska Operativnom Sistemu).

Note Icon

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


Vidi jos: open

Syntax:


  FileAttr (Channel As Integer, Attributes As Integer)

Return value:

Cjelobrojno

Parameters:

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.

Ako oznacite parametar atributa sa vrijednosti 1,sljedece povratne vrijednosti se primjenjuju:

1 - UNOS (fajl otvoren za unos)

2 - ISPIS (fajl otvoren za ispis)

4 - NASUMICNO (fajl otvoren za nasumicni pritup)

8 - DODATI (fajl otvoren za dodavanje)

32 - BINARNO (fajl otvoren za binarni oblik).

Error codes:

5 Invalid procedure call

52 Nevažeći naziv datoteke ili broj datoteke

Example:


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
    IsŔtampati #iBroj, "Prvi red teksta"
    MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
    MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
    Close #iNumber
End Sub

Please support us!