Newsgroups: comp.sys.mac.programmer
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!m.cs.uiuc.edu!ux1.cso.uiuc.edu!resnick
From: resnick@cogsci.uiuc.edu (Pete Resnick)
Subject: Re: creating resources
Message-ID: <1991Mar21.234809.26603@ux1.cso.uiuc.edu>
Sender: usenet@ux1.cso.uiuc.edu (News)
Organization: University of Illinois at Urbana
References: <1065@ub.d.umn.edu>
Date: Thu, 21 Mar 1991 23:48:09 GMT
Lines: 40

jgreene@ub.d.umn.edu (john greene) writes:

>I want to create a resource that contains several thousand
>integers.  It is easy to create a resource that contains strings
>and then convert the strings to integers but this was too slow.
>Could some kind soul tell me how to create a resource that
>contains a list of integers?  Preferably, I would like a program
>to create the resource file and fill it with the integers rather
>than typing the thousands of integers in by hand.

Three things:
1. You *really* don't want to create a resource with thousands
of integers anyway. There is a Tech Note on why not to abuse
the Resource Manager in just this way. I would be much better
to use the data fork of the file to store your integers. If
you need them in memory, just read them into a handle from there.

2. If you **REALLY** want them in a resource, it is quite easy.
Remember that in memory, a resource is just a handle to some
stuff, whether it be character or numeric data. So create a
handle to a bunch of integers in your program and call
AddResource on that handle. Easy.

3. If the problem is that you are using ResEdit and want to
type in a resource made up of integers, you can just type
the values in hex into the hex editor, or you could create
a template (TMPL resource) for your integer resource type
which defines a list of DWRD's or HWRD's. See the ResEdit
manual for how to do this. I don't think you will want to
type them in anyway, and I would choose either of my above
recommedations over this.

Good luck,
pr
--
Pete Resnick             (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD
