Hi,
Below is sample code of what I would like to do (which does not work).
Function BBB allocates memory and loads the buffer and then
AAA uses the data and then deletes the buffer.
The pointer to the memory buffer does not get passed back to AAA
correctly.
So I have missed something in the way the MemPtr function work.
I would like to know how to make it work with the MemPtr functions.
Thanks,
Ken
//----------------------------------------------------------------------
//----------------------------------------------------------------------
void AAA(void)
{
UInt8* iBuffPtr=NULL;
UInt16 iLen;
iLen = BBB(iBuffPtr);
//do something with iBuffPtr
MemPtrFree(iBuffPtr);
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
UInt16 BBB(UInt8* iDataPtr)
{
UInt16 iLen;
Char sStr[] = "Test Data";
Err err;
iLen = StrLen(sStr);
iDataPtr = (UInt8*)MemPtrNew(iLen+1);
err = MemMove (iDataPtr, sStr,iLen+1);
return iLen+1;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/