<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > typedef struct formInfoRsrc > { > UInt32 dbType; > UInt32 dbCreator; > char dbName[32]; > UInt16 useDatabase; > UInt32 key; > UInt16 numFields; > fieldDesc field[1]; // this is actually the first of several fields > } formInfoRsrc; > > // since field[1] is actually the first of numFields fields I need to allocate memory for the new resource by doing: > // p = MemPtrNew( sizeof(formInfoRsrc) - sizeof(fieldDesc) + (numFields * sizeof(fieldDesc))); > // but I am not really sure how to do this as I don't know numFields until I read the resource. > [...] > MemHandle h > formInfoRsrc *p > > h = DmGetResource('data', 1000) > p = MemHandleLock(h)
The field array is accessed thru p->field[x] where x >=0; x < ((MemHandleSize(h) - sizeof(formInfoRsrc) + sizeof(fieldDesc))/sizeof(fieldDesc)) Is this what you are getting at? Alan -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
