የ ፋይል መለያ ተግባር

የ መድረሻ ዘዴ ይመልሳል ወይንም የ ፋይል መድረሻ ቁጥር ለ ፋይል ለ ተከፈተ በ መክፈቻ አረፍተ ነገር: የ ፋይል መድረሻ ቁጥር ነፃ ነው ከ መስሪያ ስርአት (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 የሚቀጥለውን ዋጋ መፈጸሚያ ይመልሳል

1 - ማስገቢያ (ለ ማስገቢያ ፋይል መክፈቻ)

2 - ውጤት (ለ ውጤት ፋይል መክፈቻ)

4 - በ ደፈናው (ፋይል መክፈቻ በ ደፈናው ለ መድረስ)

8 - መጨመሪያ (ለ መጨመሪያ ፋይል መክፈቻ)

32 - BINARY (ፋይል መክፈቻ በ binary ዘዴ).

የ ስህተት ኮዶች:

5 ዋጋ የሌለው የ አሰራር ጥሪ

52 ዋጋ የሌለው የ ፋይል ስም ወይንም የ ፋይል ቁጥር

ለምሳሌ:


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

Please support us!