FB II COMPILER
Set a bit
I'm writing a routine that will set the hasCustomIcon bit for a file.
So far I can see if the bit is set or not:
DIM pBlk.ioHFQElSiz DIM 63 fname$ fname$ = FILES$(_fOpen,,,fVol) LONG IF fname$ <> "" pBlk.ioCompletion& = 0 pBlk.ioNamePtr& = @fname$ pBlk.ioVRefNum% = fVol pBlk.ioResult% = 0 LONG IF FN GETCATINFO(@pBlk) = _noErr LONG IF ((pBlk.ioFlUsrWds.fdFlags% AND BIT(10)) <> 0) PRINT "Has BIT set" XELSE PRINT "BIT is not set" END IF END IF END IFbut I don't have a clue about how to set the bit itself
Never did figure out the FB BIT function in FB. You can use the toolbox call CALL BITSET aas follows:
CALL BITSET (pBlk.ioFlUsrWds.fdFlags% , 15 - 10)the TB Bit calls have the MSB-LSB backwards from most other calls. If you are using a long here, it would be 31 - 10
Also, I believe pBlk.ioFlUsrWds.fdFlags% OR BIT(10) would also set it.
Chris Young, Jay & Pete
You're on the right track. Do this:
pBlk.ioFlUsrWds.fdFlags% = pBlk.ioFlUsrWds.fdFlags OR BIT(10then call FN SETCATINFO.
(Oh yeah--always be sure to reset the pbBlk.ioDirID& field before calling FN SETCATINFO, because your FN GETCATINFO call tends to alter that field's value.)