Probably because StrAToI is expecting a '\0' terminated string and you're
not providing it.  Try char digit[2];digit[1]='\0'; etc.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Arne Gemsa
Sent: Tuesday, February 07, 2006 8:49 AM
To: Palm Developer Forum
Subject: Problems with StrAToI

Hi,

I´ve got a problem with StrAToI. I´ve got the following code for Palm OS 5.4
on a T5:

UInt32 TextUtilsExtractVersion(const Char *pSourceStr, const UInt32 *pPos)
{
  UInt32 i = *pPos;
  UInt16 len = StrLen(pSourceStr);
  Boolean leave = false;
  UInt32 ret = 0;
  char digit;
        
  //search for first numeric character
  while ( !leave && i < len)
  {
    digit = *(pSourceStr+i);
  
    if (TxtCharIsDigit(digit))
    {
      FrmCustomAlert(CUSTOMALERT, "Number found", &digit, " "); 
      ret += StrAToI(&digit);
    }else
    {
      if (ret!=0) leave = true;          
    }
                 
    i++;
  }
        
  return ret;
}

TxtCharIsDigit(digit) found a numeric character but StrAToI returns 0. Why?

Regards
Arne
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to