[comp.sys.mac.programmer] Isn't there an OpenResFile where you supply a VRe

wysocki@husc9.harvard.edu (Christopher Wysocki) (04/30/91)

In article <1655@babcock.cerc.wvu.wvnet.edu> un020070@vaxa.wvnet.edu writes:

>The usual OpenResFile takes a string as its arguement.  This
>string is the filename of the resource file to be opened.
>
>Isn't there a newer function which does the same thing, but
>which also takes a volume reference number so that the
>location of the file can be specified?  I seem to remember
>reading about such a procedure somewhere, but I can't find
>the documentation now when I look.

I think you're looking for HOpenResFile, which is documented in Tech Note 214:

FUNCTION HOpenResFile(vRefNum: INTEGER;
	dirID: LONGINT;
	fileName: Str255;
	permission: SignedByte): INTEGER;

The HOpenResFile routine opens an existing resource file in the directory
specified by vRefNum and dirID and it returns the refNum of the resource file.
If the refNum equals P1, you should call _ResError to check for errors.  This
routine also lets you open a resource file without creating a working
directory.

>If there is such a procedure, when was it introduced?  With
>the MacPlus ROM?

HOpenResFile is implemented as a glue routine with THINK C, so I'm not sure if
it is in the 128k ROM found in the Mac Plus.  I do believe that it is in the
ROM of the Mac II and later machines, though.

Chris Wysocki
wysocki@husc9.harvard.edu

keith@Apple.COM (Keith Rollin) (05/01/91)

In article <1991Apr30.070640.744@husc3.harvard.edu> wysocki@husc9.harvard.edu (Christopher Wysocki) writes:
>In article <1655@babcock.cerc.wvu.wvnet.edu> un020070@vaxa.wvnet.edu writes:
>
>>If there is such a procedure, when was it introduced?  With
>>the MacPlus ROM?
>
>HOpenResFile is implemented as a glue routine with THINK C, so I'm not sure if
>it is in the 128k ROM found in the Mac Plus.  I do believe that it is in the
>ROM of the Mac II and later machines, though.

HOpenResFile was first implemented as glue in MPW 3.0. Symantec incorporated
it into their THINK products soon after.

HOpenResFile is not in any ROM. However, there is a trap number
allocated for it. The glue checks to see if that trap is implemented.
If it is, the glue calls it. If not, the glue emulates it.


-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc. 
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"But where the senses fail us, reason must step in."  - Galileo