Activa JavaScript nel restolador p'amosar l'ayuda de LibreOfficeDev.

FileAttr Function

Devuelve el mou d'accesu o'l númberu d'accesu d'un ficheru que s'abrir cola instrucción Open. El númberu d'accesu de ficheru depende del sistema operativu (OSH = remanador de sistema operativu).

Iconu de nota

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


Consulte tamién: Open

Syntax:


  FileAttr (Channel As Integer, Attributes As Integer)

Return value:

Enteru

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.

Si especifica un atributu de parámetru con un valor de 1, aplíquense los valores de torna siguientes:

1 - INPUT (ficheru abiertu pa entrada)

2 - OUTPUT (ficheru abiertu pa salida)

4 - RANDOM (ficheru abiertu p'accesu aleatoriu)

8 - APPEND (ficheru abiertu pa adjunción)

32 - BINARY (ficheru abiertu en mou binariu).

Error codes:

5 Llamada a procedimientu non válida

52 Nome de ficheru o númberu incorrectos

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 #iNúmberu, "Esta ye una llinia de testu"
    MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
    MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
    Close #iNumber
End Sub