If you are asking a basic 'C' question, then the following will work just fine:
unsigned long size; size = (unsigned long)((char *)pOffset - (char *)PDBData) + 1; Otherwise, you are asking a basic 'C++' question, so might I recommend the following: unsigned long size; size = static_cast<unsigned long>(reinterpret_cast<char *>(pOffset) - reinterpret_cast<char *>(PDBData)) + 1; On 11/8/06, Greg <[EMAIL PROTECTED]> 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? This is not the right way --->>>> size = static_cast<Int32>(pOffset) - static_cast<Int32>(PDBData); So I can write it to a record: MemMove(pNewData, PDBData, size); Thanks Greg -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
-- yisdersomenimororsisasisdenderisorsis? Jeff Loucks -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
