I am trying to lock a chunk, read a UInt32 from the start and a BitmapPtr
from the end and I had this working perfectly using C with 

  MemHandle recHandle;
  MemPtr recPtr;
  UInt16 theSize;
  BitmapPtr pSig;
  UInt32 nID;

  recHandle = DmQueryRecord(m_db, m_nPointer);
  recPtr = MemHandleLock(recHandle);

  theSize = MemPtrSize(recPtr);
  pSig = (BitmapPtr)MemPtrNew(theSize);
    
  MemMove(&nID, recPtr, sizeof(UInt32));
  MemMove(pSig, recPtr[sizeof(UInt32)], MemPtrSize(recPtr)-sizeof(UInt32)); 
  MemHandleUnlock(recHandle);

I know that this is messy - but for various reasons it wouldn't work well
for me using structs - however - when I move the app to C++ it will not
compile at all - the line 

  MemMove(pSig, recPtr[sizeof(UInt32)], MemPtrSize(recPtr)-sizeof(UInt32)); 

gives me an "invalid type" error referring to the recPtr[sizeof(UInt32)]
part - I have tried doing recPtr+=sizeof(UInt32) also but it did not like
it.

Now - I know that this error is valid C++ because I tried doing the same
thing in Visual C++ and it would not compile either - however I would like
to know how I can accomplish this - ie. given a void pointer advance it x
bytes and read from the end - I have had a look through all the Memory
Manager functions but there does not seem to be anything there.

Thanks guys 'n' gals.

Fergal....
PS. I seem to remember offering a prize brought in a lot of responses last
week - so free pint of Guiness for the first correct answer pulled out of
the hat!!

-- 
WASP Technologies
http://www.wasptech.com
Wireless Application Solutions Provider 

-- 
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