IBM Lotus Symphony
|
返回使用 Open 语句所打开文件的访问方式或文件访问号。文件访问号取决于操作系统(OSH = 操作系统句柄)。
![]() |
如果使用 32 位操作系统,那么无法使用 FileAttr 函数来确定文件访问号。 |
另请参阅:Open
FileAttr (FileNumber As Integer, Attribute As Integer)
整数
FileNumber:使用 Open 语句打开的文件号。
Attribute:表明要返回的文件信息类型的整型表达式。可能的值包括:
1:FileAttr 函数表明文件的访问方式。
2:FileAttr 函数返回操作系统的文件访问号。
如果指定参数属性值为 1,那么可以应用以下返回值:
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:\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