Aug 10, 2013 at 5:39pm UTC
Ok,
I am making a console application. It will have several threads and one of them is this input loop. Here is the function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
void getallinput()
{
outstr m;
int in;
while (ALWAYS)
{
in = 0;
in = PressAnyKey();
timeafterkey = 0;
scrsaveron = false ;
if (iscntrl(in) && !isspace)
{
switch (in)
{
case VK_ESCAPE:
exit(0);
continue ;
case VK_F1:
if (SoundState)
{
notice = "Sound Off!\n" ;
SoundState = !SoundState;
continue ;
}
else if (!SoundState)
{
notice = "Sound On!\n" ;
SoundState = !SoundState;
continue ;
}
else
{
continue ;
}
case VK_F9:
scrsaveron = true ;
continue ;
}
}
else if (isalpha(in))
{
if (isupper(in))
{
in_stream << char (toupper(in)); //In_stream is //my stringstream input stream
continue ;
}
else if (islower(in))
{
in_stream << char (tolower(in));
continue ;
}
else
continue ;
}
else if (isdigit(in) || isspace(in) || ispunct(in))
{
in_stream << in;
continue ;
}
else
{
continue ;
}
}
return ;
}
I am using cctype for the char comparison funcs. So my problem is that when I press escape the program should exit. However, no matter what input I enter, It does nothing. Can someone tell me what I am doing wrong?
Thanks
EDIT: Disch(or anyone else) please don't tell me to not use the console. When I finish this program, I am going to use a GUI. :)
Last edited on Aug 10, 2013 at 5:43pm UTC
Aug 12, 2013 at 3:51am UTC
Anyone? I really am stuck with this. I am using Duoas's PressAnyKey(modified) by the way.
Last edited on Aug 12, 2013 at 3:51am UTC
Aug 12, 2013 at 2:41pm UTC
If you echo to the screen what "PressAnyKey()" is returning, is it what you expect it to be?
Aug 12, 2013 at 6:46pm UTC
Esc showes up as left arrow. All letters are uppercase. Shift is a triange.
So wierd.