[futurebasic] Re: [FB] network file busy

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Wed, 28 Apr 1999 20:59:59 -0500

Doug Stemen wrote:

> Will the following variable "busy% " always be non-zero

> if the file is opened with "I" ,"N",or "R"?
>
> DIM 255 ParamBlock$
> pbPtr&=@ParamBlock$
>
> pbPtr&.ioCompletion&=0
> pbPtr&.ioNamePtr&=@fsName$
> pbPtr&.ioVRefNum&=fsVRefNum%
> pbPtr&.ioFDirIndex&=0
>
> GET FILE INFO ParamBlock$
>
> busy%=PEEK(pbPtr&+_ioFlAttrib)

You've got the right idea, but here are 3 caveats:

1.  Change the "&" to "%" at the end of pbPtr&.ioVRefNum and
pbPtr&.ioFDirIndex.  If you use the wrong suffix, FB won't complain, but the
data will get stored in the wrong place and the GET FILE INFO won't work
right.

2. You should also initialize pbPtr&.ioDirID& before calling GET FILE INFO.
It looks like you're using elements from an fsSpec record (i.e., fsName$,
fsVRefNum%), in which case you should set pbPtr&.ioDirID& equal to the
fsParID& element.

3. It's better to check busy% like this:

  busy% = (PEEK(pbPtr&+_ioFlAttrib) AND BIT(7))

   That's because there are some "reserved" bits in the ioFlAttrib byte.
Those bits will _probably_ always be zero, but "reserved" means that Apple can
flip them to 1 whenever they feel like it.  By checking busy% the way I've
written, you're only looking at the 1 bit which definitely indicates whether
the file is busy.

Hope this helps.
- Rick