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

DISK I/O

Get the size of a volume


CLEAR LOCAL
LOCAL FN getFreeBytes&(volNum)
  DIM 255 paramBlock$
  DIM 63 volName$
  DIM volPtr&, IoVAlBlkSiz&, IoVFrBlk&, NumBytes&

  volPtr& = @paramBlock$
  volName$ = FILES$(-1,"",,volNum)

' POKE SELECTED INFO INTO PARAMBLOCK
  &volPtr&+_ioResult,0&
  &volPtr&+_ioNamePtr,@volName$
  %volPtr&+_ioCompletion,0&
  &volPtr&+_ioVRefNum,0&

' NOW READ REST OF VOLUME INFORMATION INTO PARAMBLOCK
  GET VOLUME INFO paramBlock$

  IoVAlBlkSiz& = [volPtr&+_ioVAlBlkSiz]
  IoVFrBlk& = PEEK(volPtr&+_ioVFrBlk)*256+PEEK(volPtr&+_ioVFrBlk+1)
  NumBytes& = IoVFrBlk&*IoVAlBlkSiz&

END FN = NumBytes&

Greg