Console text input
Heres my situation. I am writing a program that is a console text program but is more interface driven, clearing the screen after something happends as opposed to letting it scroll. I have some text fields where the user should only be able to enter thirty characters. After those thirty characters I dont want anymore showing up and drawing all over the interface I constructed. I have spent a few hours on this using all manner of loops and toying with getch, getche, and getchar - all to no avail.
I also need to do something when the user hits ESC. Ive been checking chars for 27, but all the if statements Ive tried never seem to catch it.
Im on Windows XP Home using Dev-C++ 220.127.116.11
Any suggestions would be greatly appreciated. Thanks for your time.
i dont know dev c++ has this function but in turbo c u can use kbhit() function.this function checks for current keystrokes
the below code should do the job.. but let me tell you that the function i used in non standard.. and the rest of the char array may contain junk unless it is initilized to NULL..
# include <iostream.h>
while(ch!=27 && count<=30)