Greg wrote:
> I have a MemPtr that is as a pointer to a custom structure
> (pdbLayout)
> 
> PDBData = static_cast<pdbLayout*>(MemPtrNew(size));
> 
> This is also the start of my data.
> 
> I have a second pointer (Char* pOffset) that locates the 
> end of the data.
> 
> How can I find the size of the data?

As Jeff said, cast both pointers to Char* and subtract.  If your end pointer 
points to just beyond the end of your memory block (i.e., it's an exclusive 
endpoint), you don't need the +1.  If it's inclusive, you do.

On Palm OS, you also simply could call MemPtrSize to get the size of a block 
allocated with MemPtrNew.
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to