Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

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


PBHDelete

You can use the PBHDelete function to delete a file or directory.

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

DESCRIPTION
The PBHDelete function removes a file or directory. If the specified target is a file, both forks of the file are deleted. In addition, if a file ID reference for the specified file exists, that file ID reference is also removed.

A file must be closed before you can delete it. Similarly, you cannot delete a directory unless it's empty. If you attempt to delete an open file or a nonempty directory, PBHDelete returns the result code fBsyErr. PBHDelete also returns fBsyErr if you attempt to delete a directory that has an open working directory associated with it.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro for PBHDelete is _HDelete.

RESULT CODES
noErr0No error
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename
fnfErr-43File not found
wPrErr-44Hardware volume lock
fLckdErr-45File is locked
vLckdErr-46Software volume lock
fBsyErr-47File busy, directory not empty, or working directory control block open
dirNFErr-120Directory not found or incomplete pathname
afpAccessDenied-5000User does not have the correct access

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996