You didn't allocate any space for the strings!  price and disc need to be at least 
large enough to hold the string version of the number.

You can either do
#define numChars        16

Char  price[numChars],

//or

Char* price = MemPtrNew(numChars*sizeof(Char));

StrIToA(price, (UInt32)record.iPrice);

// Draw it or whatever ...

MemPtrFree(price);


This question has been asked and answered many times on this forum, so please check 
the archives.


Kevin

-----Original Message-----
From: Cygnus Saint [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 7:10 PM
To: Palm Developer Forum
Subject: problem with StrIToA function


hi seniors,

i have the following code.

        ...
        UInt32 price;
        UInt32 disc;
        ...
        -------------------------
        ...
        Char*    price,disc;
        ...
        StrIToA (price, (UInt32)record.iPrice);
        StrIToA (disc, (UInt32)record.iDisc);
        ...

i set a breakpoint just before StrIToA function is executed. Then, i check the value 
of 'price'
and 'disc'. i was surprised that the first statement assigns the value of 'price' and 
'disc' with
the converted value of record.iPrice. It happens to the second statement as well while 
its
executed, it assigns those variables with record.iDisc. i have already verified my 
record's value
by setting breakpoints somewhere and it is correct. 

How can i convert and assign the value of record.iPrice to price, and record.iDisc to 
disc?

thx u for ur helps.


http://movies.yahoo.com.au - Yahoo! Movies
- Vote for your nominees in our online Oscars pool.

-- 
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 Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to