Set file attributes
QuickBasic
' DOS 2+ - CHMOD - SET FILE ATTRIBUTES
'$INCLUDE: 'qb.bi'
DIM inregs AS RegTypeX
DIM outregs AS RegTypeX
DIM byte AS INTEGER
DIM filename AS STRING
filename = "C:\INT\125.txt" + CHR$(0)
' File Attributes
' Bit
' 7 pending deleted files
' 6 unused
' 5 archive
' 4 directory
' 3 volume label
' 2 system
' 1 hidden
' 0 read-only
inregs.CX = &H20 ' new file attributes
inregs.DS = VARSEG(filename)
inregs.DX = SADD(filename)
inregs.AX = &H4301
' read-only and hidden do not work in DOSBox
' DOS interrupt with sub-function &H4301
CALL INTERRUPTX(&H21, inregs, outregs)
IF outregs.FLAGS AND 1 THEN
PRINT "Error setting file attributes >> " + filename
BEEP: END
END IF