Sorry I'll expand a bit
UIntPtr recIds;
UInt numRecords;
UInt Index;

DbIdsHandle = MemHandleNew(indexBufSz*sizeof(Char));
ChoicesHandle = MemHandleNew(choicesBufSz*sizeof(UInt));
recIds = (UIntPtr)MemHandleLock(DbIdsHandle);
choices = (CharPtr)MemHandleLock(ChoicesHandle);

 if(numRecords+1>indexBufSz)
       {
       indexBufSz+=1;
       choicesBufSz+=RECEIPT_FOR_SIZE;
       MemHandleUnlock(DbIdsHandle);
       MemHandleUnlock(ChoicesHandle);
       err = MemHandleResize(DbIdsHandle, indexBufSz*sizeof(UInt));
       err = MemHandleResize(ChoicesHandle, choicesBufSz*sizeof(Char));
       recIds = MemHandleLock(DbIdsHandle);
       choices = MemHandleLock(ChoicesHandle);
       }//if(numrecords)
recIds[numRecords]= Index;

----- Original Message -----
From: "Aaron Ardiri" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, September 27, 2000 5:59 PM
Subject: Re: Writing to UIntPtr


>
> > Guys,
> > Is there any other way to write to a dynamic array of integers other
> > than:
> > UIntPtr recIds;
> > UInt numRecords;
> > UInt Index;
> > recIds[numRecords]= Index;
> >
> > as this causes a fault in POSE "...has just written directly to memory
> > manager data structures".
>
>   of course, you have not initialized the pointer.. :))
>
> {
>   recIds = (UInt16 *)MemPtrNew(sizeof(UInt16) * numRecords);
>   recIds[index] = ...;    // 0 < index < numRecords
>   MemPtrFree(recIds);
> }
>
>   cheers
>
> // az "why did i only sleep 4 hours last night :("
> [EMAIL PROTECTED]
> http://www.ardiri.com/    <--- free games!
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to