Examples: FileAttr function

' The following example creates a file and displays its 
' attributes.

%Include "lsconst.lss"
Dim mode As String, msg As String
Dim hdl As Integer, fileNum As Integer
fileNum% = FreeFile()
Open "data.txt" For Append As fileNum%
hdl% = FileAttr(fileNum%, ATTR_HANDLE)
Select Case FileAttr(fileNum%, ATTR_MODE)
   Case 1 : mode$ = "Input"
   Case 2 : mode$ = "Output"
   Case 4 : mode$ = "Random"
   Case 8 : mode$ = "Append" 
   Case 32 : mode$ = "Binary"
End Select

Close fileNum%
Print "DOS File Handle = "; hdl%; "Mode = "; mode$