PBHOpenDFSync
PBHOpenDF
Open the data fork of a file on a hierarchical volume OSErr PBHOpenDF(pb, async ); Boolean async ; 0=await completion; 1=immediate return Use the PBHOpenDF function to open the data fork of a file on a hierarchical
volume. PBHOpenDF replaces PBHOpen , which can open either a driver or the data fork of a file.
pb is a pointer to a IOParam structure.The relevant fields are as follows:
Æ ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE) ¨ ioResult short 2 16 Error Code (0=no error, 1=not done yet)
Æ ioNamePtr StringPtr 4 18 pointer to file or directory name Æ ioVRefNum short 2 22 Volume reference
¨ ioRefNum short 2 24 access path number
Æ ioPermssn char 1 27 permission
Æ ioDirID long 4 48 parent directory ID
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.
noErr (0) No error
nsvErr (-35) Volume not found
ioErr (-36) I/O error
bdNamErr (-37) Bad filename
tmfoErr (-42) Too many files open
fnfErr (-43) File not found
opWrErr (-49) File already open for writing
extFSErr (-58) External file system
dirNFErr (-120) Directory not found
Notes: PBHOpenDF creates an access path to the data fork of a file. It is almost
identical to PBHOpen . The difference is that PBHOpen can open both files and drivers, but PBHOpenDF can open only files. Using PBHOpenDF
instead of PBHOpen when your application is opening a file pr events naming conflicts or ambiguities and ensures that your application can open
files whose names begin with a period (.).
PBHOpenDF takes a permission parameter
In most cases, you can simply set the permission parameter to fsCurPerm.
Some applications request fsRdWrPerm, to ensure that they can both read
and write to a file. The constants that can be passed in this field are the
following:
fsCurPerm exclusive read/write permission if it is available;
otherwise, exclusive read, if that is available
fsRdPerm exclusive read permission
fsWrPerm exclusive write permission
fsRdWrPerm exclusive read/write permission
fsRdWrShPerm shared read/write permission
In shared environments, permission requests are translated into the
"deny-mode" permissions defined by AppleShare.