On Wed, Aug 13, 2003 at 06:41:19PM -0500, [EMAIL PROTECTED] wrote:

> Okay, this a bit of a dorky question. I asked at a C Forum, and this
> was the suggestion. I'm hoping this is a Palm Dev Forum related issue:

It is a C issue, although the error message you get is a bit nicer than
the error message you might get from another OS.

>       typedef struct
>       {
>             UInt32 *orderQty;
>             Char *key;
>             Char *desc;
>       } OnOrder;
> 
>       onOrder.orderQty = (UInt32 *) StrAToI(FldGetTextPtr(field));      // Gets the 
> number from the field

This is not such a good idea because StrAToI doesn't like NULL pointers,
and if the user has never entered something into the field, then it will
complain. 

It's also completely illegal. What good is converting an integer into a
pointer going to do you?

>       UnpackOnOrder(&onOrderFound, packedOnOrder);          // Grabs from
> pdb
>       *(onOrder.orderQty) += *(onOrderFound.orderQty);            // THIS LINE 
> CAUSES THE ERROR

Well, since you did that bizarre assignment earlier, the value of
orderQty is whatever value was in the form. My guess is that it was 20,
since your error message was "Application just read from memory location
0x0000000014", and 0x14 == 20.

You should get a good book on C and programming with C pointers. If the
people on the C forum had read your code more carefully, they would have
seen the problem as well.

-- 
Dave Carrigan
Seattle, WA, USA
[EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL

Dave is currently listening to Crosby, Stills, Nash & Young - This Old House (American 
Dream)

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

Reply via email to