Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!lll-winken!ames!dftsrv!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: creating resources Message-ID: <1991Mar24.193356.11251@eng.umd.edu> Date: 24 Mar 91 19:33:56 GMT References: <1065@ub.d.umn.edu> Sender: news@eng.umd.edu (C-News) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 37 In article <1065@ub.d.umn.edu> jgreene@ub.d.umn.edu (john greene) writes: >I am an experienced pascal programmer but a novice Mac programmer. >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. >Thanks for any help. I don't know why you would want thousands of integers in a resource-- I would think a random-access data file would be a better idea, but: Type INTS = array [1..numofints] of Integer; IntPtr = ^INTS; IntHandle = ^IntPtr Var ThousInt: Handle; myints: IntPtr; ThousInt = NewHandle (SizeOf(INTS)); (* I THINK mac pascals all have SizeOf *) HLock(ThousInt); myints = IntPtr(ThousInt^) myints[1] = whatever; myints[2] = whatever; myints[3] = whatever; ... myints[numofints] = whatever; AddResource(Handle(ThousInt), 'Ints', 3838 (* ID # *), "Name"); -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu .sig under construction, like the rest of this campus.