LibreOffice 25.2 Help
ត្រឡប់របៀបដំណើរការ ឬលេខដំណើរការឯកសារនៃឯកសារមួយ ដែលត្រូវបានបើកជាមួយសេចក្តីថ្លែងការណ៍ Open ។ លេខដំណើរការឯកសារគឺពឹងផ្អែកលើប្រព័ន្ធប្រតិបត្តិការ (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)
ចំនួនគត់
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