[comp.sys.mac.programmer] GetResource help

borcelf@jacobs.cs.orst.edu (Fernando Borcel) (02/17/89)

Hi!.  I've been having a little trouble trying to get resources by using the
procedure call GetResource.  I KNOW I'm doing something wrong that's very
obvious, but I can't find what it is.  I have an application which reads a 
resource named 'KEY ' from its resource fork.  There are 6 such resources,
which consist of a bunch of zeroes (for now),which I want to store in an array
of handles of that resource type.  The problem:  When I execute the code below,
the contents of keys[ID]^^ are DIFFERENT from the original ones (zeroes).
What am I doing wrong?  Here's the code(LSP 2.0):

type
	KeyType = record
			Name: str255;  {Empty string}
			freq1: integer;{Set to zero}
			freq2: integer;{Set to zero}
		end;
	KeyPtr = ^KeyType;
	KeyHandle = ^KeyPtr;

var
	keys: array[13..18] of keyHandle;
	ID: integer;

begin
	for ID := 13 to 18 do
		Keys[id] := KeyHandle(getResource('KEY ', ID));
end;  


---

Any help will be appreciated!

		-Fernando Borcel
"Tact is the ability to tell a man he has an open mind when he has a
hole in his head."  Internet:     borcelf@jacobs.cs.ORST.EDU
                    UUCP:{tektronix,hp-pcd}!orstcs!jacobs.cs.orst.edu!borcelf