Hilfe für LibreOffice 7.6
Gibt den Zugriffsmodus oder die Dateizugriffsnummer einer mit der Anweisung Open geöffneten Datei zurück. Die Dateizugriffsnummer ist vom Betriebssystem abhängig (OSH = Operating System Handle, Betriebssystem-Handle).
If you use a 32-Bit operating system, you cannot use the FileAttr function to determine the file access number.
Siehe auch: Open
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.
Wenn Sie den Attribute-Parameter als 1 festlegen, sind folgende Rückgabewerte möglich:
1 – INPUT (Datei zur Eingabe geöffnet)
2 – OUTPUT (Datei zur Ausgabe geöffnet)
4 – RANDOM (Datei mit wahlfreiem Zugriff)
8 – APPEND (Datei zum Erweitern geöffnet)
32 – BINARY (Datei im Binärzugriff geöffnet).
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, "Das ist eine Zeile Text"
MsgBox FileAttr(#iNumber, 1), 0, "Zugriffsmodus"
MsgBox FileAttr(#iNumber, 2), 0, "Datei-Zugriffsnummer"
Close #iNumber
End Sub