Good Day...

Could anyone help me figure out this.. 

I used the "GetStringFromDouble()" that i copy from this forum...

then i have this Runtime exceptions:
"error68k.c, Line:1568, Write to FormType (id 1600) off: 0, size: 1"

when i click on ignore button the second exception appears 
"error68k.c, Line:1568, Write to FormType (id 1600) off: 6, size: 1"

then ignore again and it appears
"error68k.c, Line:1568, Write to FormType (id 1600) off: 5, size: 1"

after the third exception.. my form dsplays the expected out put..

my code snippet.

static void SetOrderDetails()
{
  Int32 itemCode,qty;
  double price = 0,temp = 0;
  char* doubleStr;
  itemCode = StrAToI(itemID);
  qty = StrAToI(itemQuantity);
  switch (itemCode)
  {
    case 1001:
    itemNameDetails  = "SOME TEXT HERE!!!!"; //30 chars
    itemNameDetails2 = "SOME TEXT HERE!!!!"; ";
    itemPrice = "100.21";
                        
    temp = GetDoubleFromString(itemPrice);
    price = temp * ((double)qty);
    GetStringFromDouble(doubleStr,price,2);
    itemTotal = doubleStr;
    break;
  default:
    itemNameDetails             = "-----N/A------"; 
    itemNameDetails2            = "-----N/A------";
    itemPrice                           = "-----N/A------";
    itemTotal                           = "-----N/A------";
    break;
        }
}

the "GetDoubleFromString()" function works find...

void GetStringFromDouble(Char* str, double dblNum, Int16 numFractDigits)
{
double flpIP, zeros, round;
Int32 remainder, longNumber;
Int16 i, strLen;
Char buffer[16];

str[0] = 0;

if (dblNum < 0.0)  //<------- I remove the "D" coz it will not compile with 
it...
{
        dblNum = -dblNum;
        StrCat(str, "-");
}

zeros = 1.0;
for (i = 0; i < numFractDigits; i++)
{
        zeros *= 10.0;
}
round = 0.5 / zeros;

dblNum += round;
flpIP = (Int32) dblNum;
dblNum -= flpIP;

StrIToA(buffer, (Int32) flpIP);
StrCat(str, buffer);
strLen = (Int16) StrLen(str);
StrCat(str, "."); // put in the decimal point and terminate the string
str[numFractDigits + strLen + 1] = '\0';
longNumber = (Int32) (dblNum * zeros); // fractional part

for (i = numFractDigits + strLen; i > strLen; i--)
{       
        remainder = longNumber % 10; // convert the integer part
        str[i] = (Char) (remainder + 0x30);
        longNumber /= 10;
}
}

Can any1 share his.her ideas? c",)


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

Reply via email to