Luciano,
I get a different memory location but the same effect if I try to cast
'display" as a char * in the line from CtlGetValue.
The function code is as follows:
Boolean MainFormDoCommand(UInt16 command)
{
Boolean handled = false;
//get the Main form pointer
FormType * frmP = FrmGetActiveForm();
//set up slider
ControlType * sldPtr;
char * size = "12";
char * strDisplay = "this is a test";
int display;
//set up field
FieldType *field;
UInt16 fieldIndex;
switch (command)
{
case OptionsAboutMedStim:
{
FormType * frmP;
/* Clear the menu status from the display */
MenuEraseStatus(0);
/* Display the About Box. */
frmP = FrmInitForm (AboutForm);
FrmDoDialog (frmP);
FrmDeleteForm (frmP);
handled = true;
break;
}
case MainInputSlider:
sldPtr = FrmGetObjectPtr(frmP,
FrmGetObjectIndex(frmP,MainInputSlider));
display = (long)CtlGetValue(sldPtr);//returns the
value of the slider
strDisplay = StrIToA (size,display);
fieldIndex = FrmGetObjectIndex(frmP,
MainOutputField);
field = (FieldType *)FrmGetObjectPtr(frmP,
fieldIndex);
FrmSetFocus(frmP, fieldIndex);
FldInsert(field,strDisplay,StrLen(strDisplay));
handled = true;
break;
case MainClearTextButton:
fieldIndex = FrmGetObjectIndex(frmP,
MainOutputField);
field = (FieldType *)FrmGetObjectPtr(frmP,
fieldIndex);
FldEraseField(field);
handled = true;
break;
}
return handled;
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Luciano A.
Stertz
Sent: Thursday, September 16, 2004 12:14 PM
To: Palm Developer Forum
Subject: Re: help on integer to string conversion
I mean, what are size and display?
The function prototype is:
Char *StrIToA (
Char *s,
Int32 i
)
Is 'size' a char pointer and display the integer you want to
convert?
Luciano Stertz
Luciano A. Stertz wrote:
>
> Seems you are passing the arguments in the reverse order.
>
> Luciano Stertz
>
> [EMAIL PROTECTED] wrote:
>
>> Hi,
>>
>> I'm looking for any help on why using "strDisplay = StrIToA
>> (size,display)"
>> always memory faults with the message:
>>
>>
>>
>> "App just wrote to the memory location 0x0004187C, which is in the
>> storage
>> heap."
>>
>>
>>
>> It compiles ok, but as soon as the StrIToA function is called, I get the
>> memory violation. I assume it's related to setting up the size correctly,
>> but the #define for maxStrIToALen in the header is set for 12, which
>> is what
>> I'm using. I've tried a variety of things, but they all return the same
>> error.
>>
>>
>>
>> Jim
>>
>>
>>
>>
>> Jim Coburn
>> Senior Project Director
>>
>> NDI Medical
>> 216-378-9106 x - 108 (office)
>> 216-378-9116 (fax)
>> jcoburn @ndimedical.com
>>
>>
>>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/