How to Create a Folder Using HFSDispatch in Mac QuickBASIC (57375)






This article was previously published under Q57375

SUMMARY

The program below demonstrates how to use the HFSDispatch library CALL to create a new folder from a QuickBASIC application.

This information applies to Microsoft QuickBASIC version 1.00 for the Apple Macintosh.

MORE INFORMATION

DirCreate is not a trap macro (it doesn't have an individual trap address) and therefore expands to invoke the trap macro _HFSDispatch. The File Manager determines which routine to execute from the "routine selector," an integer that is placed in the D0 register.

Routine parameters that are passed to and from an application and the File Manager are contained in a parameter block, which is a data structure in the heap or stack. Parameters are passed in a block and a pointer to the block is passed instead. See Apple's "Inside Macintosh" (published by Addison-Wesley) for more information about the parameter block.

The code below POKEs the name of the folder into the Parameter Block and then passes the pointer of the parameter block to HFSDispatch.

Code Example

   DIM iopb%(60)
   dirname$ = "Test folder"
   dirname$ = CHR$(LEN(dirname$)) + dirname$
   POKEL VARPTR(iopb%(0)) + 18, SADD(dirname$)
   HFSDispatch 6,iopb%(0)    '6 is the Routine Selector value for
                             'creating a folder.
   END
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB57375