other possibilities:  pszRecord is NULL, or StrLen(pszRecord) + 1 is >
largest available heap chunk so pNextChar is NULL.

to echo Joe, what exactly is "blowing up"?

unrelated to that, why allocate heap space for a copy of the *pszRecord
string?  could you not simplify the method by examining the string in place
(declaring 'const CharPtr pszRecord' for good measure)?

...steve

"Fitzpatrick, Joe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Well, one thing that stands out is that if the pattern "," does not
appear,
> you read past the end of the allocated block.  Are you blowing up inside
the
> for loop?
>
> -jjf
>
> -----Original Message-----
> From: Ralph Krausse [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 22, 2000 6:51 AM
> To: Palm Developer Forum
> Subject: Wrong code shown....
>
>
> Opps. this was the code.....
>
> Word CListObject::_GetLastPos(CharPtr pszRecord)
> {
> VoidHand vHandle = MemHandleNew(StrLen(pszRecord) + 1);
> CharPtr pNextChar  = (CharPtr)MemHandleLock(vHandle);
> StrCopy(pNextChar,pszRecord);
>
> int wTotalCount = 0;
> for(;*pNextChar;pNextChar++)
> {
> if(*pNextChar == '\"'  && *(pNextChar + 1) == ',' &&
> *(pNextChar + 2) == '\"')
> {
> break;
> }
> wTotalCount++;
> }
>
> MemHandleUnlock(vHandle);
> MemHandleFree(vHandle);
> return wTotalCount;
> }
>
> --
> 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 ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to