Path: utzoo!yunexus!geac!geaclib!rae From: rae@geaclib.UUCP (Reid Ellis) Newsgroups: comp.sys.mac.programmer Subject: Re: SAMPLE cdev in C Keywords: cdev, getresource, packages in rom Message-ID: <3646@geaclib.UUCP> Date: 6 Feb 89 10:41:46 GMT Article-I.D.: geaclib.3646 References: <1845@helios.ee.lbl.gov> Reply-To: rae@geaclib.UUCP (Reid Ellis) Organization: T'nir Software Lines: 29 osborn@ux1.lbl.gov (James R Osborn) writes: | I have been attempting to do the SAMPLE cdev given in IM-V p.323 |using LSC 3.01p3. I was simply trying to do a direct translation from the |example in Pascal to C. When I try to run the damn thing (in the control |panel), the ICN# shows up properly and I can select it. Sometime soon |after it has drawn in the gray background and the specified nrct, it crashes I, too was bitten with this. The problem is that the example, as written, will not work with newer ROMs. To determine if there is sufficient RAM available, it calls GetResource to load a PACK [or is it PKGE?] resource. With the new ROM, this package is in ROM and thus the call to GetResource returns NULL [the resource isn't in any open file, after all]. To fix this, either change the call to NGetResource [I think that's what it's called -- I don't have IM V handy, sorry] which checks ROM resources as well, or else re-write the code entirely and just check for enough free memory for the cdev. I wrote a cdev that used this same GetResource thing and got bitten when the new ROMs came out. Alas, I lost the source [at least I couldn't find it last time I checked] so it is lost forever. It just diddled with intl0 and intl1 resources, along the lines of "Simon" [but it let you change the short date separator too -- I don't like "/"]. Hope this helps, Reid "Will Vooper and Honest Crocus obliterate Ylum in a vicious arms race? Let's all stay up late worrying about it!"