FileAttr Function

Liveras la aliran reĝimon aŭ la dosieran aliran numeron de dosiero malfermita per la ordono Open. La dosiera alira numero dependas de la mastruma sistemo (OSH = Operating System Handle, t.e. referenco de mastruma sistemo).

Nota bildsimbolo

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


Vidu ankaŭ: Open

Syntax:


  FileAttr (Channel As Integer, Attributes As Integer)

Return value:

Entjero

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.

Se oni specifas parametran atributon kun valoro de 1, la jenaj valoroj estas livereblaj:

1 - INPUT (file open for input)

2 - OUTPUT (file open for output)

4 - RANDOM (file open for random access)

8 - APPEND (file open for appending)

32 - BINARY (file open in binary mode).

Error codes:

5 Nevalida procedurvoko

52 Nevalida dosiera nomo aŭ dosiera numero

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
    Print #iNumero, "Jen linio de teksto"
    MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
    MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
    Close #iNumber
End Sub

Bonvolu subteni nin!