FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

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 IF
but I don't have a clue about how to set the bit itself
Pete

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(10
then 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.)
Rick