Enable JavaScript in the browser to display LibreOfficeDev Help pages.

FileAttr Function

ওপেন স্টেটমেন্টের মাধ্যমে খোলা একটি ফাইলের প্রয়োগন মোড অথবা ফাইল প্রয়োগ ক্রম প্রদান করে থাকে। ফাইল প্রয়োগ ক্রমটি অপারেটিং সিস্টেমের উপর নির্ভরশীল (OSH = Operating System Handle)।

নোট আইকন

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


আরও দেখুন: খুলুন

Syntax:


  FileAttr (Channel As Integer, Attributes As Integer)

Return value:

Integer

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.

আপনি যদি মান ১ সহকারে একটি প্যারামিটারের বৈশিষ্ট্য উল্লেখ করেন, তাহলে নিচের প্রদান মান প্রয়োগ হয়:

1 - INPUT (ইনপুটের জন্য ফাইলটি খোলা)

2 - OUTPUT (আউটপুটের জন্য ফাইলটি খোলা)

4 - RANDOM (র‍্যান্ডম প্রয়োগের জন্য ফাইল উন্মুক্ত)

8 - APPEND (পরিশেষে যোগ করার জন্য ফাইলটি খোলা)

32 - BINARY (বাইনারী মোডে ফাইলটি খোলা)।

Error codes:

5 Invalid procedure call

52 Bad file name or number

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 #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