HOpenRF
HOpenRF Open the resource fork of an existing file
#include <Files.h> File Manager
OSErr HOpenRF( vRefNum, dirID, fileName, permission, frefNum );
short vRefNum ; volume or directory reference number
long dirID; ID of directory where that file resides in
Str255 fileName ; address of length-prefixed full or partial name
SignedByte permission; File Permission (1 = read, 2 = write, etc.)
short *fRefNum ; receives file reference number
returns Error Code; 0=no error
HOpenRF opens the resource fork of an existing file. Resources are
normally accessed via the Resource Manager functions such as LoadResource,
GetResource, GetCursor, etc., that manage the resource map and other
details automatically. It is functionally equivalent to OpenRF, except that
you can specify a File Permission level. About the only reason to use HOpenRF
is to perform a file-copy operation.
vRefNum is the reference number of the volume or directory containing
fileName . See FSOpen for the various options.
dirID is the directory ID of the directory that the file resides in.
fileName is the address of a length-prefixed, pascal-style string containing
the name of the file to be opened. It may be a partial or full
pathname, depending upon the value of vRefNum .
permission indicates the access permission level that the file should be opened
with. See the Notes section below for the constants that can be used in
this field
fRefNum is the address of a 16-bit short. Upon return, it will contain the
file reference number (also called the access path number) of the
file's resource fork. This value is used in all subsequent operations
on the open file.
Returns: an operating system Error Code. It will be one of:
noErr (0) No error
bdNamErr (-37) Bad name
extFSErr (-58) External file system
ioErr (-36) I/O error
nsvErr (-35) No such volume
opWrErr (-49) File already open with for writing
tmfoErr (-42) Too many files open

Notes: HOpenRF 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 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.