HOpen
HOpen Open the data fork of a file
#include <Files.h> File Manager (PBxxx)
OsErr HOpen( vRefNum, dirID, fileName, permission, refNum );
short vRefNum; volume or working directory refNum (0 = default)
long dirID; directory ID of volume containing file
Str255 fileName; address of full/partial path/file name
SignedByte permission; File Permission (1 = read, 2 = write, etc.)
short * refNum; returns file reference number
returns Error Code; 0=no error
HOpen opens the data fork of a file, enabling I/O operations. It is
functionally equivalent to FSOpen, but you can specify a File Permission
level.
Returns: an operating system Error Code. It will be one of:
noErr (0) No error
bdNamErr (-37) Bad name
extFSErr (-58) External file system
fnfErr (-43) File not found
ioErr (-36) I/O error
nsvErr (-35) No such volume
opWrErr (-49) File already open for writing
permErr (-54) Attempt to open locked file
tmfoErr (-42) Too many files open

Notes: The permission field specifies read-only, read/write, and sharing
options. 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
parameter 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.
Use PBOpenRF for direct access to the resource fork of a file.
The most common way to obtain ioNamePtr and ioVRefNum is by using the
Standard File Package, as illustrated in this example. See FSOpen for
related information and a similar example.