Important: The information in this document is obsolete and should not be used for new development.
PBHOpen
You can use thePBHOpen
function to open the data fork of a file. BecausePBHOpen
will also open devices, it's safer to use thePBHOpenDF
function instead.
FUNCTION PBHOpen (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.
--> ioCompletion
ProcPtr
A pointer to a completion routine. <-- ioResult
OSErr
The result code of the function. --> ioNamePtr
StringPtr
A pointer to a pathname. --> ioVRefNum
Integer
A volume specification. <-- ioRefNum
Integer
A file reference number. --> ioPermssn
SignedByte
The read/write permission. --> ioDirID
LongInt
A directory ID. DESCRIPTION
ThePBHOpen
function creates an access path to the data fork of the specified file and returns a file reference number in theioRefNum
field.You can open a path for writing even if it accesses a file on a locked volume, and no error is returned until a
PBWrite
,PBSetEOF
, orPBAllocate
call is made.If you attempt to open a locked file for writing,
PBHOpen
returns the result codepermErr
. If you request exclusive read/write permission but another access path is already open,PBHOpen
returns the reference number of the existing access path inioRefNum
andopWrErr
as its function result. You should not use this reference number unless your application originally opened the file.
- WARNING
- If you use
PBHOpen
to try to open a file whose name begins with a period, you might mistakenly open a driver instead; subsequent attempts to write data might corrupt data on the target device. To
avoid these problems, you should always usePBHOpenDF
instead
ofPBHOpen
.ASSEMBLY-LANGUAGE INFORMATION
The trap macro forPBHOpen
is_HOpen
.RESULT CODES