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:

ཧྲིལ་ཨང་།

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.

ཁྱོད་ཀྱིས་ཚད་བཟུང་ཁྱད་ཆོས་གཅིག་ཁར་གནས་གོང་་ ༡ གསལ་བཀོད་འབད་བ་ཅིན་་འོག་གི་སླར་ལོག་གནས་གོང་ཚུ་འཇུག་སྤྱོད་འབད:

༡ - ཨིན་པུཊི(file open for input)

༢ - ཨའུཊི་པུཊི (file open for output)

༤ - གང་བྱུང་ (file open for random access)

༨ - མཇུག་བསྣོན་འབད (file open for appending)

༣༢ - ཟུང་ལྡན (file open in binary mode).

Error codes:

༥ ནུས་མེད་བྱ་སྒོའི་ལམ་ལུགས་བོད་བརྡ་

༥༢ བྱང་ཉེས་ཡིག་སྣོད་མིང་ཡང་ན་ཨང་གྲངས་

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
    དཔར་བསྐྲུན་འབད#ཨའི་ཨང་ "This is a line of text"
    MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
    MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
    Close #iNumber
End Sub

Please support us!