contradictory if statements
just wondering how to do this code, because i have 2 if statements in different functions, one says to do one thing if it gets left arrow, other one does something different when left arrow is it.
code:
void function1 ()
{
key=getch();
if(key==KEY_LEFT) //already declared key left before
printf("item one");
}
void function2 ()
{
key2=getch();
if(key2==KEY_LEFT)
printf("SUCCESS!!!");
}
this code makes it always say "item one" and doesn't work when it is in the second funcion. help would be appreciated :)
eureka! i've got it !!!!!
finally after many many many many many many many hours of my time experimenting with different ways, using one function, trying out what different ppl suggested before i was able to get it to work, thanx to all the ppl who helped out, and here is my function which works :D
Code:
int my_getch ()
{
int input=getch();
if (input==224)
input=getch();
else if (input==0)
input=256+getch();
return input;
}
boy talk about a lot of time for such a little simple thing, but i'm so happy
:D :D :D