[comp.sys.mac.programmer] Creating a Resource Fork

mikeoro@hubcap.clemson.edu (Michael K O'Rourke) (11/06/89)

No, i don't just want to know how to create a resource fork.  Obviously,
i'd just use CreateResFile.  What i am trying to do is open the resource
fork for an existing file, but a file which currently doesn't have a
resource fork.  Therefore, if i use OpenResFile or OpenRFPerm, they return
-1 because there isn't a resource fork.  If i call CreateResFile, it thinks
i want to overwrite the existing file and it returns an error.

So how to i Create the resource fork so that i may open it and copy some
resource to it from another file?  What is the trick, or am i just 
thinking completely backwards?  I looked at the Tech Notes and didn't seem
to find anything of great help.

Mike O'Rourke

tim@hoptoad.uucp (Tim Maroney) (11/09/89)

In article <6956@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu
(Michael K O'Rourke) writes:
>No, i don't just want to know how to create a resource fork.  Obviously,
>i'd just use CreateResFile.  What i am trying to do is open the resource
>fork for an existing file, but a file which currently doesn't have a
>resource fork.  Therefore, if i use OpenResFile or OpenRFPerm, they return
>-1 because there isn't a resource fork.  If i call CreateResFile, it thinks
>i want to overwrite the existing file and it returns an error.

What error?  I use CreateResFile to create resource forks for existing
files and it works fine.  This is actually the recommended way of using
CreateResFile, due to some weirdness involving the Poor Person's Search
Path.  See some tech note or other (OK, I'll check -- it's 101).  Of
course, you have to frame it in volume-setting stuff, like:

GetVol -- get old volume
SetVol -- set volume of existing file
CreateResFile -- with name of existing file
SetVol -- back to old volume
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

FROM THE FOOL FILE:
"Yet another piece of evidence that it's a Communist society which is being
 presented as good, but which we probably would not want to live in."
	-- Ken Arromdee on rec.arts.startrek, on the Federation's Red Menace