Blitz (126/218)

From:David McMinn
Date:20 Aug 2001 at 09:23:41
Subject:Re: Read Protection

Hi Paul

> It seems ReadFile returns true even if the file is
> read protected but then commands like Inkey$ causes
> a debugger error or crash if debugger is off,
> so is there a way to tell if a file is read protected?

DEFTYPE.FileInfoBlock *fib
filename$="work:foo/bar"

*fib = AllocDosObject_(#DOS_FIB,0)
If *fib
lock.l = Lock_(&filename$, #ACCESS_READ)
If lock
If Examine_(lock,*fib)
If *fib\fib_Protection & (1 LSL 3)
NPrint "Read protection bit set"
EndIf
EndIf
UnLock_ lock
EndIf
FreeDosObject_ #DOS_FIB, *fib
EndIf



|) /\ \/ ][ |) |\/| c |\/| ][ |\| |\| | dave@blitz-2000.co.uk
http://members.nbci.com/david_mcminn | ICQ=16827694
You! Off my planet!!

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie