I think you'll find the last if statement is changing the address of the
TempCode string (strings are just addresses in C) to point to the static
"0000\0" string you define. Once you've done this the first time I think
you'll find you can't change the string contents any more (actually I'm
surprised the Palm Emulator doesn't complain when you try to).

I'd say instead of this:

if( // the '#' button is pressed )
{
    *TempCode = "0000\0";
    CurChar = 0;
}

You should do something like this:

if( // the '#' button is pressed )
{
    StrCopy( TempCode, "0000\0" );
    CurChar = 0;
}

But then I could be wrong ;) hope that helps!

Stuart Nicholson
Programmer
Firepad, Inc.

-----Original Message-----
From: Patrick Ouellet [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 12, 2000 5:48 PM
To: Palm Developer Forum
Subject: Newbie to Palm question about using variable


Ok I tried something really easy.

// Regular C of what I want to do.

char TempCode[4] = "0000\0";
int CurChar = 0;

if( // the button #2 is pressed )
{
    TempCode[CurChar] = '2';
    CurChar++;
}

if( //the button #3 is pressed )
{
    TempCode[CurChar] = '3';
    CurChar++;
}

if( // the '#' button is pressed )
{
    *TempCode = "0000\0";
    CurChar = 0;
}

But no matter what I do TempCode never change.

Is there something I don't know I really should
Or am I just a id10t

--
Patrick Ouellet, Programmeur/Analyste
Département: Recherche & Développement
Les Entreprises Microtec Inc.
4780 rue St-Félix, St-Augustin, Qc, G3A-2J9
(418) 864-7644 poste 130
[EMAIL PROTECTED]
http://www.microtecsecurite.com/



-- 
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