> on 4/30/02 10:19 AM, STAZ at staz@... wrote: > >> this would be better as... >> >> FILES$(_fsopen... >> resRef = FN fsopenresfile(...) >> >> LONG IF resRef > 0 >> fcodH = FN GET1RESOURCE(_"FCOD",1000) >> fcodSz = FN GETHANDLESIZE(fcodH) >> startPtr = [fcodH] >> endPtr = (startPtr + fcodSz) - 10 >> // 10 is number of bytes you are searching for >> FOR ptrLoc = startPtr TO endPtr STEP 2 >> LONG IF ptrLoc.nil% = 0x4E71 >> LONG IF ptrLoc.2% = 0x51C8 >> LONG IF ptrLoc.4% = 0xFFFC >> LONG IF ptrLoc.6% = 0x4CDF >> LONG IF ptrLoc.8% = 0x0101 >> // found you signature >> // do something >> END IF >> END IF >> END IF >> END IF >> END IF >> NEXT >> >> CLOSERESFILE(resRef) >> END IF >> >> >> >> i just corrected res thingies. i did not check other items in the file. > > Should the resource be locked before we start to examine the contents? good point. while the code shown does not move memory, the 'do something' remarked location probably will. bracket things with... LONG IF resRef > 0 fcodH = FN GET1RESOURCE(_"FCOD",1000) LONG IF fcodH hState = FN HGETSTATE(fcodH) HLOCK (fcodH) blah...blah... HSETSTATE(fcodH,hState) END IF > > I usually do HLOCK before I do anything with a resource and HUNLOCK after > I'm done. > > Is this necessary or am I adding unnecessary steps? > > Bill Sanford > General Manager > Director of Engineering > bsanford@... > 218-751-3407 ext. 115 > Lakeland Public Television > http://www.lakelandptv.org > > Watch Lakeland News at 10 on our web site! > http://www.lakelandptv.org/pages/lakeland_news/lakelandnewscasts.html > > > > > -- > To unsubscribe, send ANY message to <futurebasic-unsubscribe@...> >