LibreOffice 7.6 Help
āĻāĻĒā§āύ āϏā§āĻā§āĻāĻŽā§āύā§āĻā§āϰ āĻŽāĻžāϧā§āϝāĻŽā§ āĻā§āϞāĻž āĻāĻāĻāĻŋ āĻĢāĻžāĻāϞā§āϰ āĻĒā§āϰā§ā§āĻāύ āĻŽā§āĻĄ āĻ āĻĨāĻŦāĻž āĻĢāĻžāĻāϞ āĻĒā§āϰā§ā§āĻ āĻā§āϰāĻŽ āĻĒā§āϰāĻĻāĻžāύ āĻāϰ⧠āĻĨāĻžāĻā§āĨ¤ āĻĢāĻžāĻāϞ āĻĒā§āϰā§ā§āĻ āĻā§āϰāĻŽāĻāĻŋ āĻ āĻĒāĻžāϰā§āĻāĻŋāĻ āϏāĻŋāϏā§āĻā§āĻŽā§āϰ āĻāĻĒāϰ āύāĻŋāϰā§āĻāϰāĻļā§āϞ (OSH = Operating System Handle)āĨ¤
If you use a 32-Bit operating system, you cannot use the FileAttr function to determine the file access number.
āĻāϰāĻ āĻĻā§āĻā§āύ: āĻā§āϞā§āύ
FileAttr (Channel As Integer, Attributes As Integer)
Integer
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.
āĻāĻĒāύāĻŋ āϝāĻĻāĻŋ āĻŽāĻžāύ ā§§ āϏāĻšāĻāĻžāϰ⧠āĻāĻāĻāĻŋ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāĻāĻžāϰā§āϰ āĻŦā§āĻļāĻŋāώā§āĻā§āϝ āĻāϞā§āϞā§āĻ āĻāϰā§āύ, āϤāĻžāĻšāϞ⧠āύāĻŋāĻā§āϰ āĻĒā§āϰāĻĻāĻžāύ āĻŽāĻžāύ āĻĒā§āϰā§ā§āĻ āĻšā§:
1 - INPUT (āĻāύāĻĒā§āĻā§āϰ āĻāύā§āϝ āĻĢāĻžāĻāϞāĻāĻŋ āĻā§āϞāĻž)
2 - OUTPUT (āĻāĻāĻāĻĒā§āĻā§āϰ āĻāύā§āϝ āĻĢāĻžāĻāϞāĻāĻŋ āĻā§āϞāĻž)
4 - RANDOM (āϰâā§āϝāĻžāύā§āĻĄāĻŽ āĻĒā§āϰā§ā§āĻā§āϰ āĻāύā§āϝ āĻĢāĻžāĻāϞ āĻāύā§āĻŽā§āĻā§āϤ)
8 - APPEND (āĻĒāϰāĻŋāĻļā§āώ⧠āϝā§āĻ āĻāϰāĻžāϰ āĻāύā§āϝ āĻĢāĻžāĻāϞāĻāĻŋ āĻā§āϞāĻž)
32 - BINARY (āĻŦāĻžāĻāύāĻžāϰ⧠āĻŽā§āĻĄā§ āĻĢāĻžāĻāϞāĻāĻŋ āĻā§āϞāĻž)āĨ¤
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, "This is a line of text"
MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
Close #iNumber
End Sub