Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / File Manager Reference
Low-Level HFS Routines / Creating and Deleting Files and Directories


You can use the PBDirCreate function to create a new directory.

FUNCTION PBDirCreate (paramBlock: HParmBlkPtr; async: Boolean): 
A pointer to a basic HFS parameter block.
A Boolean value that specifies asynchronous (TRUE) or synchronous (FALSE) execution.
-->ioCompletionProcPtrA pointer to a completion routine.
<--ioResultOSErrThe result code of the function.
<->ioNamePtr StringPtrA pointer to a pathname.
-->ioVRefNumIntegerA volume specification.
<->ioDirIDLongIntA directory ID.

The PBDirCreate function is identical to PBHCreate except that it creates a new directory instead of a file. You can specify the parent of the directory to be created in ioDirID; if it's 0, the new directory is placed in the root directory of the specified volume. The directory ID of the new directory is returned in ioDirID. The date and time of its creation and last modification are set to the current date and time.

A directory ID, unlike a volume reference number or a working directory reference number, is a LongInt value.
The trap macro and routine selector for PBDirCreate are
Trap macroSelector

noErr0No error
dirFulErr-33File directory full
dskFulErr-34Disk is full
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename
fnfErr-43Directory not found or incomplete pathname
wPrErr-44Hardware volume lock
vLckdErr-46Software volume lock
dupFNErr-48Duplicate filename and version
dirNFErr-120Directory not found or incomplete pathname
wrgVolTypErr-123Not an HFS volume
afpAccessDenied-5000User does not have the correct access

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996