I'm trying to write a program that continues to process weather or not a key is pressed on the keyboard, but that key's pressed will change variables in the program while its running. Anyway, I've pulled out from another program what I thing will do the trick, (can't find anything about it in any tutorials), and on a more basic level,the compiler says "ISO C++ forbids comparison between pointer and integer" at lines 41 through 44. I thought that when I ran changedir it would return a char -result, into dir, which should be compared to the constants "n","s","e","w","q".where am I wrong in my logic? Also, I would appreciate any input on my logic for using keystrokes without stopping the program to wait for input. Thanks in advance!!
Replace double quotes (") with single quotes (') in lines 40 (I'm surprised the compiler didn't complain) to 44. Double quote strings are pointers to static C arrays. Single quotes strings can contain just one 8-bit character and are, in fact integers. There's also L"" and L'', but that's Unicode. You may need to use the former to interact with some WinAPI functions.
Thanks for the input helios, the compiler was complaining about the quotes, I just didn't understand what or why it was complaining.... Now that I can run the program, can you help me with one more thing??? I had hoped that the program would continue cycling through the "while" block weather or not I pressed a key, but it only seems to run when I am pressing a key.??? Any ideas how to continue running without waiting for a keystroke???
You should also change this: every time changedir() is called, you're calling GetStdHandle(). The proper way to do it is calling it just once in main() and passing the handle to all functions that need it.
Thanks guys, I tried helios' new thread method, and was having trouble getting it to work last night. I'll have to look at it again today, and try the "wait" technique. Is there a link I can go to to find out more about wait statements??
and some of the other ways they can be used??