PBDirCreateSync
PBDirCreate Create a new empty directory
#include <Files.h> File Manager (PBxxx)
OSErr PBDirCreate(pb, async );
HParmBlkPtr pb ; address of an 80-byte HFileParam structure
Boolean async ; 0=await completion; 1=immediate return
returns Error Code; 0=no error
PBDirCreate creates a new, empty directory.
pb is the address of an 80-byte HFileParam structure (or the
fileParam member of an HParamBlockRec union). The relevant
fields are as follows:
Out-In Name Type Size Offset Description
-> ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE)
-> ioVRefNum short 2 22 Volume or working directory reference
<-> ioNamePtr StringPtr 4 18 Entry: Addr of directory name (full or partial )
Return: (Appears to be un changed)
<-> ioDirID long 4 48 Entry: ID of parent directory (0=use root)
Return: ID of created directory
<- ioResult OSErr 2 16 Error Code (0=no error, 1=not done yet)
async is a Boolean value. Use FALSE for normal (synchronous) operation
or TRUE to enqueue the request and resume control immediately. See
Async I/O.
Returns: an operating system Error Code. It will be one of:
noErr (0) No error
bdNamErr (-37) Bad name
dirFulErr (-33) Directory full
dirNFErr (-120) Directory not found
dupFNErr (-48) Duplicate filename (rename)
extFSErr (-58) External file system
ioErr (-36) I/O error
nsvErr (-35) No such volume
vLckdErr (-46) Volume is locked
wPrErr (-44) Diskette is write-protected

Notes: This works like PBHCreate except that it creates a new directory instead
of a new file.
The parent directory is identified by ioDirID. If it is 0, then the standard
name/number technique is used: if ioNamePtr is valid and complete, it is
used; otherwise, ioVRefNum is a volume reference or working directory
number (as returned by SFPutFile or PBOpenWD).
The following example provides the directory's full name in ioNamePtr, so
the other fields are moot.
Example
#include <Files.h>
Str255 dirName="\pHD 20:Ltrs:1988:"; // last :' is optional
hfpb.ioNamePtr = dirName;
hfpb.ioVRefNum = 0; // ignored unless name is invalid
hfpb.ioDirID = 0; // parent is the root
rc=PBDirCreate( &hfpb, FALSE );
if ( rc ) { /* . . . handle the error . . . */ }
printf( "New directory ID: %ld \n", hfpb.ioDirID );