At 9:28 AM +0100 on 12/31/00, Hans van Maanen wrote: >Hi all > >What am I doing wrong here? >I want to put an array of 101 doubles in a resource for quick >reference in my resource file q.r as resource "Facs", nr 128. > >Somehow, the resH does not get written into the resource file after closing. >The resource is there in memory, as resH2 shows (it fills in the >first eleven doubles), but after quitting the program, the file q.r >does not contain my new resource. Or is there something wrong with >CHANGEDRESOURCE or WRITERESOURCE? > >This kind of thing used to work in FB^2! > >Help? I was curious about how to do it and not overwrite an existing file or damage an existing resource. This works ok although I didn't set the Finder info. begin globals dim k(100) as double dim a as double dim restype as double dim resH as handle dim resH2 as handle dim resnr as int dim i as int Dim curRes as Short Dim saveRes As Short end globals curRes = FN CurResFile restype = _"Facs" resnr = 128 WINDOW 1 'make array... FOR i = 0 TO 100 k(i) = i / 2730 NEXT // create res file in app's dir CreateResFile ( "q.r" ) saveRes = FN openResFile ( "q.r" ) UseResFile ( saveRes ) resH = FN Get1Resource ( resType, resnr ) 'fill resource... If resH = _nil Then resH = FN NEWHANDLE(808) LONG IF (resH <> 0) and (syserror = _noErr) hlock(resH) BLOCKMOVE @k(0), [resH], 808 hunlock(resH) ADDRESOURCE(resH, restype, resnr, "") SETRESATTRS(resH, _resPurgeable%) CHANGEDRESOURCE(resH) WRITERESOURCE(resH) RELEASERESOURCE(resH) END IF 'check memory... resH2= FN GET1RESOURCE(restype, resnr) LONG IF resH2 FOR i = 0 TO 10 BLOCKMOVE [resH2] + 8 * i, @a, 8 PRINT a NEXT END IF UseResFile ( curRes ) CloseResFile ( saveRes ) DO UNTIL FN BUTTON END