' This script creates a file and uses SetFileAttr to set the
' file attributes to Read-Only, System, and Hidden. It then
' uses GetFileAttr to verify the file attributes.
%Include "lsconst.lss"
Dim fileNum As Integer, attr As Integer
Dim fileName As String, msg As String
fileNum% = FreeFile()
fileName$ = "data.txt"
Open fileName$ For Output As fileNum%
Close fileNum%
SetFileAttr fileName$, ATTR_READONLY + ATTR_SYSTEM + _ ATTR_HIDDEN
attr% = GetFileAttr(fileName$)
If (attr% And ATTR_READONLY) Then
msg$ = msg$ & " Read-Only "
Else
msg$ = msg$ & " Normal "
End If
If (attr% And ATTR_HIDDEN) Then msg$ = msg$ & " Hidden "
If (attr% And ATTR_SYSTEM) Then msg$ = msg$ & " System "
If (attr% And ATTR_VOLUME) Then msg$ = msg$ & " Volume "
If (attr% And ATTR_DIRECTORY) Then msg$ = msg$ & " Directory "
Print msg$
SetFileAttr fileName$, ATTR_NORMAL ' Reset to normal
Kill fileName$