Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!cornell!rochester!PT.CS.CMU.EDU!cadre!jas From: jas@cadre.dsl.PITTSBURGH.EDU (Jeffrey A. Sullivan) Newsgroups: comp.sys.mac.programmer Subject: INIT Crashes-- Why? Message-ID: <1099@cadre.dsl.PITTSBURGH.EDU> Date: 29 Mar 88 02:12:19 GMT Organization: Decision Systems Lab., Univ. of Pittsburgh, PA. Lines: 36 Keywords: INIT LSC Sound Snd I wrote a simple INIT that plays a random snd at startuptime. However, after playing the sound, but before displaying the icon (with the showinit resource) it crashes with an id 10. Why would it crash? Is there something that must be done with INITs after they complete? here's the code: pascal int Count1Resources (ResType); pascal Handle Get1IndResource (ResType, int index); extern long Time : 0x20C; /* Location of Time in Ticks -- from OSUtil.h */ main() { Handle thesnd; int rand(), numsounds; ResType rt = 'snd '; srand((unsigned int)Time); numsounds = Count1Resources('snd '); thesnd = Get1IndResource(rt, (rnd(numsounds) + 1)); /* Can't be 0 */ if(thesnd) SndPlay(0L,thesnd,TRUE); ReleaseResource(thesnd); } ... That's it! Why would she crash? -- .......................................................................... Jeffrey Sullivan | University of Pittsburgh jas@cadre.dsl.pittsburgh.edu | Intelligent Systems Studies Program jasper@PittVMS.BITNET, jasst3@cisunx.UUCP | Graduate Student