RE: GetStringFromDouble() error68k.c, Line:1568, Write to FormType (id 1600) off: 0, size: 1
Looks to me like you haven't initialised the doubleStr pointer. Either declare it as; char doubleStr[MAXIMUM_LENGTH_OF_RETURNED_DOUBLE+1]; Or, before you call GetStringFromDouble; doubleStr=MemPtrNew(MAXIMUM_LENGTH_OF_RETURNED_DOUBLE+1); If you use the second option, when you're done with it, don't forget to call; MemPtrFree(doubleStr); Regards John -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.432 / Virus Database: 268.15.15/579 - Release Date: 07/12/2006 13:31 __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: GetStringFromDouble
"dilek.ozgu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i use that function. but > double xx; > xx = 816 / 10 ; > GetStringFromDouble(ss,xx, 2); > result , ss = > 81 it must be 81.60 Err. That's a C problem, not a problem with the function: xx = 816 / 10; is wrong. 816 and 10 are both integers, so an integer division is done. The result is converted to a double, hence the 81.00. xx = 816.0d / 10.0d; is what you're after. Try this. Trust me that the GetStringFromDouble function is not at fault. It's in use in many programs, and always performs flawlessly. Alan -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: GetStringFromDouble
dilek.ozgu wrote: THANKS its run. have you got the StrToDouble function.. Have you tried using the FlpAToF() function? -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
RE: GetStringFromDouble
Hello . Use this function. void doubleToStr (char *str,double flpNumber,Int numFractDigits) { long longNumber; double flpIP,zeros,round; int i,strLen,remainder; char sign=' '; if (flpNumber<0.0) { flpNumber=-flpNumber; sign='-'; } zeros =1.0; for (i=0;i round=0.5/zeros; flpNumber +=round; flpIP=(long) flpNumber; flpNumber = flpNumber - flpIP; str[0]=sign; if (sign=='-') StrIToA(&str[1],(long) flpIP); else StrIToA(&str[0],(long) flpIP); strLen=StrLen(str); str[strLen]='.'; str[numFractDigits + strLen + 1] ='\0'; longNumber = flpNumber * zeros; for (i=numFractDigits + strLen;i>strLen; i--) {remainder = longNumber %10; str[i]=remainder + 0x30; longNumber /=10; } } From: "dilek.ozgu" <[EMAIL PROTECTED]> Reply-To: "Palm Developer Forum" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> Subject: GetStringFromDouble Date: Wed, 21 Jan 2004 11:12:28 +0200 i use that function. but double xx; xx = 816 / 10 ; GetStringFromDouble(ss,xx, 2); result , ss = > 81 it must be 81.60 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08.01.2004 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ _ ¿Estás dispuesto a una cita? Conoce gente en MSN Amor & Amistad. http://match.msn.es/match/mt.cfm?pg=channel -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/